How do you handle translation of text with markup?

前端 未结 6 1363
既然无缘
既然无缘 2020-12-23 10:04

I\'m developing multi-language support for our web app. We\'re using Django\'s helpers around the gettext library. Everything has been surprisingly easy, except for the ques

6条回答
  •  暖寄归人
    2020-12-23 10:18

    What ever you do keep the whole sentence as one string. You need to understand the whole sentece to translate it correctly.

    Not all words should be translated in all languages: e.g. in Norwegian one doesn't use "please" (we can say "vær så snill" literally "be so kind" but when used as a command it sounds too forceful) so the correct norwegian vould be:

    • "Logg inn for å fortsette" lit.: "Log in to continue" or
    • "Fortsett ved å logge inn" lit.: "Continue by to log in" etc.

    You must allow completely changing the order, e.g. in a fictional demo language:

    • "Für kontinuer Loggen bitte ins" (if it was real) lit.: "To continue log please in"

    Some language may even have one single word for (most of) this sentence too...

    I'll recommend solution 1 or possibly "Please %{startlink}log in%{endlink} to continue" this way the translator can make the whole sentence a link if that's more natural, and it can be completely restructured.

提交回复
热议问题