Gettext: Is it a good idea for the message ID to be the english text?

后端 未结 11 1366
春和景丽
春和景丽 2020-12-07 16:45

We\'re getting ready to translate our PHP website into various languages, and the gettext support in PHP looks like the way to go.

All the tutorials I see recommend

11条回答
  •  清歌不尽
    2020-12-07 17:19

    I strongly disagree with Richard Harrisons answer about which he states it is "the only way". Dear asker, do not trust an answer that states it is the only way, because the "only way" doesn't exist.

    Here is another way which IMHO has a few advantages over Richards approach:

    • Start with using the proto-version of the English string as Original.
    • Don't display these proto-strings but create a translation file for English nontheless
    • Copy the proto-strings to the translation for the beginning

    Advantages:

    • readable code
    • text in your code is very close if not identical to what your view displays
    • if you want to change the English text, you don't change the proto-string but the translation
    • if you want to translate the same thing twice, just write a slightly different proto-string or just add 'version for this and that' and you still have a perfectly readable code

提交回复
热议问题