Translation Tools

flower

Topics


Install

# linux and mac
sudo npm i -g kural
# windows
npm i -g kural

Chrome Driver


Using Kural CLI to translate

kural i18n:translate

  • Kural Docs

  • Translates a given sentence into various languages and provides verification Google Translate URL (optionally) to verify the translation work

  • Uses Google Translate

# Translate to French
 kural i18n:translate -i 'Good Morning, Friends!' -f 'en' -t fr
 Bonjour les amis!

# Translate to Tamil
kural i18n:translate -i 'Good Morning, Friends!' -f 'en' -t ta        
காலை வணக்கம் நண்பர்களே!

# Translate to Telugu
kural i18n:translate -i 'Good Morning, Friends!' -f 'en' -t te      
శుభోదయం మిత్రులారా!


# Translate to Marathi
kural i18n:translate -i 'Good Morning, Friends!' -f 'en' -t mr -g true
सुप्रभात, मित्रांनो!


# Translate to Japanese and launch google translate to verify the translation work
kural i18n:translate -i 'Good Morning, Friends!' -f 'en' -t ja -g true     
おはようございます、友達!


How to prepare translation TSV from STF file

sfdx mohanc:i18n:stf:prep -i exported-2.stf > exported-2.stf.tsv

exported-2.stf.tsv

exported-2.stf.tsv

Using CLI you can convert the XLF file into TSV

  • If you exported the XLF file in the translation workbench you will have the information about the max width/size of the translation allowed for each key.

  • stf2tsvHtml.xsl used here

sfdx mohanc:xml:transform -i img/exported-2.xlf -t xsl/stf2tsvHtml.xsl

Above command will open a HTML page with TSV file loaded in a textarea. You can cut and paste the content of the textarea to create a TSV file.

Xliff2tsv

  • If you want to view the XLIFF file as a TSV page:
sfdx mohanc:xml:transform -i img/exported-2.xlf -t xsl/stf2tsv.xsl
=== Writing the output into file : img/exported-2.xlf.out.xml.html ===

xmliff2tsv

  • If you want to view the XLIFF file as a HTML page:
sfdx mohanc:xml:transform -i img/exported-2.xlf -t xsl/stf2html.xsl
=== Writing the output into file : img/exported-2.xlf.out.xml.html ===

xmliff2html


Using CLI to fill-in Salesforce translation file (STF)

NOTES

  • You can use Kural CLI to get free translations
  • You can use the csv2 for CSV to PSV conversions

CLI allows progressive filling of stf with translated files

STEPS


  1. Export STF file for a bilingual (using Translation workbench) - say our case it is French (FR)
  2. You have translated the keys in this STF file and have the translated-1.psv (Pipe Separated Value file)
  3. Create the filled value stf file batch-1.stf using this command:
sfdx mohanc:i18n:stf:fill -i exported.stf -t  translated-1.psv > batch-1.stf
cat translated-1.psv
1|ButtonOrLink.Account.Billing|Billing|Facturation
2|CustomField.Account.CustomerPriority.FieldLabel|Customer Priority|Priorité du client

batch-1.stf

batch-1

  1. Now another translation team has provided you translated-2.psv
  2. You can apply this translation on top of batch-1.stf, using this command
sfdx mohanc:i18n:stf:fill -i batch-1.stf -t  translated-2.psv > batch-2.stf

cat translated-2.psv

1|ButtonOrLink.Opportunity.DeliveryStatus|Delivery Status|Statut de livraison
2|CustomField.Account.NumberofLocations.FieldLabel|Number of Locations|Nombre d'emplacements

batch-2.stf

batch-2

  1. and so on...
  2. You can load (import) the final stf file to the org in translation workbench
  1. If you export again you will see the results of your translations:

exported-2.stf

Checking Import