Hi @joeybab3 @Mark1988 , additional auto-translated languages is being considered, but there is not confirmation or a timeline as yet. In the mean time there is a workaround to get a similar result of Google Translate translations of your store, including HTML content. It uses the Languages CSV (Settings > Languages > Export) and employs the Google Translate API inside Google Sheets, creating an API.
Video:
Steps:
- Add the language you want to translate into in Settings > Languages
- Export the Languages CSV for just that language. Open in Google Sheets
- Filter the sheet to only show blank fields in column H (where no default translations exit)
- Create a new translation function by going to Extensions, Apps Script, then paste this function:
function translation(text, froml, tol) {
// Check if source and target languages are the same
if (froml === tol) {
return ''; // Return blank if source and target languages are the same
}
// Check if source text is only a number
if (!isNaN(text)){
return ''; // Return blank if source text is only a number
}
// Convert text to string if it's not already
var inputText = String(text);
// Extract the Liquid code by matching text inside double curly brackets
var liquidCode = inputText.match(/{{\s*[\w\.]+\s*}}/g);
// Replace the Liquid code with a placeholder for translation
var cleanedText = inputText.replace(/{{\s*[\w\.]+\s*}}/g, '[[liquid_code_placeholder]]');
// Translate the cleanedText
var translatedText = LanguageApp.translate(cleanedText, froml, tol, {contentType: 'html'});
// Restore the Liquid code in the translated text
if (liquidCode) {
liquidCode.forEach(function(code, index) {
translatedText = translatedText.replace('[[liquid_code_placeholder]]', code);
});
}
return translatedText;
}
- Then go and deploy your API:
- Press “Run”, and return to Sheets. Then you can use the function in the sheet, for example:
=translation(G2,"en",D2)
- And copy that down across the column. This will take some time to process all cells.
- Once complete, export the CSV. Go back to Settings > Languages > Import.
- This should give you a translated storefront. Publish the language.
