Skip to content

Pick Language

Astisme edited this page Jan 14, 2026 · 6 revisions

Explanation

By changing the extension language setting, you can decide in which language Again, Why Salesforce presents its texts.

All the available languages are listed when clicking on the dropdown for this setting (if you cannot find your favourite language, it is currently unsupported).

By default, the extension uses the English texts. If you prefer, you may set it to follow your current Salesforce user language (this requires us to read one of your cookies; this permission is currently only used for this use case).

If a translation is not available in the selected language, the English one will be used in its place.

Technicalities

Location

All translations are found here and are always exposed when the extension is active and the user is on a Salesforce page (see the manifest at the key web_accessible_resources).

The sub-folders follow the standard structure for extension localization; the languages taken into consideration are listed here.

Implementation

There is one file which deals with the translation.

The English translation is always loaded when the class is instantiated to ensure a graceful fallback in case of missing translations.

Localized texts which include a \n will have this character replaced by <br /> when inserted into the page.

When this file is imported from a .html file, it searches through all the elements to find the ones marked with a data-i18n= tag (even if we do not use this API); then it gets the translation from the currently selected language .json file (which is kept in-memory to avoid having to fetch it every time).

The data-i18n tag must contain the key to the corresponding translation in the locale .json file or no translation will be found and the text contained will be shown to the user. Furthermore, the tag may contain a separator (for now equal to +-+) + where the translated text should be displayed (textContent | innerText | title | ...).

Example

These are all valid data-i18n attributes for the translator class:

  • my_localized_text -> will translate my_localized_text and put the translation into textContent
  • my_localized_text+-+textContent -> same as above
  • my_localized_text+-+title+-+textContent -> will translate my_localized_text and put the translation into textContent and in title

You may continue adding +-+ with another attribute to add the localization to that attribute as well.

Clone this wiki locally