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

Translation export files: clarification on purpose and current working #327

Open
lmeyer1 opened this issue Apr 1, 2022 · 0 comments
Open

Comments

@lmeyer1
Copy link
Contributor

lmeyer1 commented Apr 1, 2022

Current state
This is how the translation for the theme works now

  • Suppose, the theme uses 200 texts, of which only 1 is not in the core.
  • When translating the theme it now show correctly only one text missing (thanks to this PR)
  • I translate the missing text and change the wording of another translation
  • I download the theme xlf files

I expect the xlf files for the theme to contain 2 translations, the one I added and the one I changed the wording, but the xlf files contain all the 200 texts of the theme.

Under The exported package it is written:

Note: If a given wording is not translated, then the original wording should be used as translation in the exported file.

This note is about not translated wordings. It is not about wordings that are translated, but not overridden.

The two options when overriding wording
The translation of themes is special, because the theme translation is overriding the core translation. This problem is not related to BO and FO-core translations.
For modules that have an official translation in app/Resources/translations, the translation overriding the core translation, like for themes. Thus, in the following, you can read also module every time theme is used.

If we translate a theme, most of the wordings are already present in the core translation. There will be few wordings specific to the theme, and there will be some translations that will be adapted.

  1. All texts: As for now, the exported xlf files may contain all texts used in the theme, and their translations.
  2. Only specific: The exported xlf files may contain only texts either specific to the theme or overridden core translations.

Purpose of the xlf files
As far as I understand, the purpose of the exported xlf files is twofold:

  • Include the translation files in a public version of the theme
  • Save the translations in a VCS instead of the database

Comparing the two options
Only specific has in my opinion several advantages over All texts:

  • From a theoretic perspective, All texts is clearly in contradiction with DRY principles.
  • In practice this means: When core translations are updated, the theme will never use them. The theme translation will be stuck at the wording at the time I first exported the xlf files.
  • When the files contain Only specific translations, they are more meaningful when looking at them. Only the relevant few wording are there, instead of dozens. This specially applies when we use the xlf files for VCS
  • When we include the translation files in a public version of the theme, we should never need All texts, because the core translation packs already contain all the other texts. This only requires to use the translation packs of the lowest supported PS version when generating the language files.

What are your thoughts about this?

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

No branches or pull requests

1 participant