mix elementorex.gen.locale (ElementorexCms v0.2.0)

Copy Markdown View Source

Generates a locale module (ElementorexCms.I18n.Locale) per language with every string to translate: the labels, help texts, options and default texts of your blocks, the names of your templates and the names of your sources of dynamic content and their fields.

$ mix elementorex.gen.locale es pt de fr it ja
$ mix elementorex.gen.locale ko --name 한국어

For the languages the library ships (es, pt, de, fr, it, ja) the module only has your app's strings; the editor is already translated. For any other language it also has every string of the library, so the whole editor can be translated. --all adds them for a built-in language too, pre-filled with the library's translation, to override some.

Creates lib/my_app_web/elementorex_locales/pt.ex (module MyAppWeb.ElementorexLocales.Pt). Register the modules:

config :elementorex_cms, locales: [MyAppWeb.ElementorexLocales.Pt]

Untranslated strings are nil (they fall back to English). Run the task again after adding blocks: the translations already in the module, and those in the :translations config, are kept (it asks before overwriting the file).

Options

  • --all - include the strings of the library
  • --name - name of the language in that language (default: the library's name for built-in languages, otherwise the code)
  • --namespace - module namespace (default MyAppWeb.ElementorexLocales)
  • --force - overwrite existing files without asking