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

后端 未结 11 1374
春和景丽
春和景丽 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

    There is a lot to consider and answer is not so easy.

    Using plain English

    Pros

    • Easy to write and READ code
    • In most cases, it works even without running translation functions in code

    Cons

    • Involved programmers must be also good copywriters :)
    • You need to write correct precise texts fully in English, even in the case that first language you need to run is something else (ie we're starting lof of projects in Czech language and we're localizing them to EN later).
    • In a lot of cases, you need to use contexts. If you fail to do it from begginig, it's a lot of work to add them later. To explain: In English, one word can have many different meands - and you need to use contexts to differentiate them - and it's not always so easy (order = sort order, or it can be purchase order).
    • It can be very hard to correct English later in the process. Corrections of the source strings will very often lead to loss of already translated phrases. It's very frustrating to loose translation to 3 different languages just because you corrected English.

    Using keys

    Pros

    • You can use localization platform functions even for the English language. I.e. we're using the lovely Crowdin platform. There is a lot of handy tools - or rather a complete workflow - for translation management: voting for different translations, translation history, glossaries (which helps to keep translation/language coherent), proofing, approval, etc. Using keys make this process much more smooth.

    • It's much easier to send Engish texts for proofreading etc. Usually, it's not a good idea to let copywriters to modify your code directly :)

    Cons

    • More complicated project setup.
    • Harder to use %d, %s etc.

提交回复
热议问题