Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Categorised translations or adding multi-file support to PostBuild #339

Open
ajbeaven opened this issue Apr 26, 2017 · 1 comment
Open

Comments

@ajbeaven
Copy link
Contributor

ajbeaven commented Apr 26, 2017

It'd be great to be able to categorise a translation so a subset of translations could be handled separately. My site has an administration backend that needs to have different translations available to that of the public site.

Currently, PostBuild dumps all the translations in to a single file messages.pot/messages.po and only these files are used to display translations. It would be nice if multiple translation files could be generated and used based on a single in a nugget. Perhaps something like this:

[[[This translation is the default case]]]
[[[This translation is a special case\\\specialcase]]]
[[[This translation is another special case\\\specialcase]]]

The first nugget would be added to the default messages.pot and the others generate .pot/.po files based on the key specified in the nugget:

messages.pot
- This translation is the default case

specialcase.pot
- This translation is a special case
- This translation is another special case

Because all translations are currently dumped in a single file, translators are required to sift through all translations as many may not be relevant for them. Unless I add comments to each nugget, this is often an impossible task. It would be a better experience for the translators for me to send them a single .po file and they can just simply translate them all.

I understand that reading multiple .po files is already supported (i18n.LocaleOtherFiles) so perhaps this just needs to be an improvement to PostBuild that allows it to generate the separate PO databases. The changes added in #314 may be useful here and to many, may be a more elegant approach.

@Sshnyari
Copy link
Contributor

Sshnyari commented Jun 1, 2017

Here is a start for doing this.
I didn't submit a PR because it still has some issues :

  • A context and a comment are stored in the same list which can lead to strange behaviours if there are manually written comments in the po files. In my opinion, there should be a clear separation between comments and contextes.
  • When the option is activated, the default po[t] file contains only tokens with no context at all (ie : if a nugget have a "contextless" version and another one with a context, the contextless version is skipped)
  • If a context have the same name of the default po[t] file, one of the files will be overwritten during generation

categorized-po-files.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants