30 Ocak 2017 Pazartesi

xliff (Localization)

Mark message parts that should not be translated

Often strings contain text that shouldn’t be translated to other languages. Common examples might be a piece of code, a placeholder for a value, a special symbol, or a name. As you prepare your strings for translation, look for and mark text that should remain as-is, without translation, so that translators don’t change it.
To mark text that should not be translated, use an <xliff:g> placeholder tag. Here's an example tag that ensures the text "%1$s" will not be changed during translation (otherwise it could break the message):
<string name="countdown">
    <xliff:g id="time" example="5 days>%1$s</xliff:g>until holiday</string>
When you declare a placeholder tag, always add an id attribute that explains what the placeholder is for. If your apps will later replace the placeholder value, be sure to provide an example attribute to clarify the expected use.
Here are some more examples of placeholder tags:
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Example placeholder for a special unicode symbol -->
<string name="star_rating">Check out our 5

    <xliff:g id="star">\u2605</xliff:g>
</string>
<!-- Example placeholder for a for a URL -->
<string name="app_homeurl">

    Visit us at <xliff:g id="application_homepage">http://my/app/home.html</xliff:g>
</string>
<!-- Example placeholder for a name -->
<string name="prod_name">

    Learn more at <xliff:g id="prod_gamegroup">Game Group</xliff:g>
</string>
<!-- Example placeholder for a literal -->
<string name="promo_message">

    Please use the "<xliff:g id="promotion_code">ABCDEFG</xliff:g>” to get a discount.
</string>

...
</resources>

Hiç yorum yok:

Yorum Gönder