How to organize Gettext .pot files in sub-folders?

@sfusato Yes it is possible. For example you can house a .pot file in priv/gettext/foo/bar.pot and the .po files in priv/gettext/foo/locale/LC_messages/bar.po and then exact and merge via mix gettext.extract && mix gettext.merge priv/gettext/foo using dgettext("foo/bar", "string to translate").

Here is an example repo where the translated strings are in lib/gettext_example_web/controllers/page_controller.ex:

Personally I would probably just get creative with my domain naming and keep the default file structure. nav_sidebar in your case, for example.

1 Like