mix mishka_cms_core.gettext.extensions (Mishka CMS Core v0.0.1)

Copy Markdown View Source

Adds every message the extensions mark with MishkaCmsCore.Gettext to the core's .pot file of its domain.

An extension writes use Gettext, backend: MishkaCmsCore.Gettext, so its words are translated from the core's .po files. mix gettext.extract writes the templates of the backends of the project it runs in only, so run this in the core after it, with the extensions checked out beside the core, and merge the templates into the .po files again:

mix gettext.extract --merge --no-fuzzy
mix mishka_cms_core.gettext.gervaz
mix mishka_cms_core.gettext.extensions
mix gettext.merge priv/gettext --no-fuzzy

With no arguments it reads ../mishka_blog and ../mishka_document. Give the paths of the extensions to read others:

mix mishka_cms_core.gettext.extensions ../mishka_blog ../mishka_document ../my_extension

In each one it runs this task again, in the dev environment and with --core naming the core. There the task compiles the extension with Gettext's extractor on, through mix gettext.extract, and writes what its gettext, dgettext, ngettext, *_noop and other Gettext macros mark with MishkaCmsCore.Gettext into the core's templates: every domain, plural forms, the text a HEEx template or a MishkaGervaz DSL option marks, and the reference of each mark. Run in an extension by hand, it writes into the :mishka_cms_core dependency, or into the core --core names:

mix mishka_cms_core.gettext.extensions --core ../mishka_cms_core

A message the core writes too is left as it is. Any other keeps its references into the extension, beside those of MishkaGervaz and the other extensions, which the project's :excluded_refs_from_purging keeps through the next mix gettext.extract, so mix gettext.extract --check-up-to-date still passes. A message neither an extension nor MishkaGervaz has any longer is removed. See Mix.MishkaCmsCore.GettextTemplates.