4

There is Translation Strategy option with two values

  • Dictionary (Translation on Storefront side)
  • Embedded (Translation on Admin side)

Path: Stores -> Configuration -> Advanced -> Developer -> JavaScript Setting -> Translation Strategy

What's the pros and cons of these two strategies?

  • i just spent one day to understand why in developer mode lib/mage/validation.js went under view_preprocessed and none symlink created but copied with differences! The differences were the translations replaced because EMBEDDED was setted. – LucScu Sep 30 '17 at 11:16
7

Translation strategy under JavaScript settings is applied only for strings rendered from JavaScript.

Dictionary

All js and html files are parsed for string that should be translated (f.e. strings from "$.mage.__()" or "i18n:"). Collected string are translated and outputted to js-translation.json file. This file is used for dynamic translation during javascript execution on frontend.

Dictionary strategy is better for development. Js files remain untouched.

Embedded

All js and html files are intercepted during publishing to pub/static and translation calls are replaced with result translated strings.

Embedded strategy is better on production. This strategy is performing translation only once on backend and avoids additional request for translation dictionary, so it has some positive effect on frontend performance.

Embedded strategy can not work in developer mode when static content is published using symlinks.

Additionally

Patterns used to find string to translate for both strategies are configured in DI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.