@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Document internationalization

Test Plan: Generated docs.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1139

Differential Revision: https://secure.phabricator.com/D2779

vrana 6b8295d1 1053a50f

+61
+61
src/docs/contributing/internationalization.diviner
··· 1 + @title Internationalization 2 + @group contrib 3 + 4 + What is required from developers to get Phabricator translatable. 5 + 6 + = API = 7 + 8 + Translator API is provided by libphutil. It gives us `PhutilTranslator` class 9 + and global `pht()` function built on top of it. 10 + 11 + Developers are supposed to call `pht()` on all strings that require translation. 12 + 13 + Phabricator provides translations for this translator through 14 + @{class:PhabricatorTranslation} class. 15 + 16 + = Adding a New Translation = 17 + 18 + Adding a translation which uses the same language rules as some already existing 19 + translation is relatively simple: Just extend @{class:PhabricatorTranslation} 20 + and you will be able to specify this class in the global configuration 21 + 'translation.provider' and users will be able to select it in their preferences. 22 + 23 + = Adding a New Language = 24 + 25 + Adding a language involves all steps as adding a translation plus specifying the 26 + language rules in `PhutilTranslator::chooseVariant()`. 27 + 28 + = Singular and Plural = 29 + 30 + Different languages have various rules for using singular and plural. All you 31 + need to do is to call `pht()` with a text that is suitable for both forms. 32 + Example: 33 + 34 + pht('%d beer(s)', $count); 35 + 36 + Translators will translate this text for all different forms the language uses: 37 + 38 + // English translation 39 + array('%d beer', '%d beers'); 40 + 41 + // Czech translation 42 + array('%d pivo', '%d piva', '%d piv'); 43 + 44 + The ugly identifier passed to `pht()` will remain in the text only if the 45 + translation doesn't exist. 46 + 47 + = Male and Female = 48 + 49 + Different languages use different words for talking about males, females and 50 + unknown genders. Callsites have to call `pht()` passing @{class:PhabricatorUser} 51 + (or other implementation of `PhutilPerson`) if talking about the user. Example: 52 + 53 + pht('%s wrote', $actor); 54 + 55 + Translators will create this translations: 56 + 57 + // English translation 58 + '%s wrote'; 59 + 60 + // Czech translation 61 + array('%s napsal', '%s napsala');