Select the types of activity you want to include in your feed.
@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
···11+@title Internationalization
22+@group contrib
33+44+What is required from developers to get Phabricator translatable.
55+66+= API =
77+88+Translator API is provided by libphutil. It gives us `PhutilTranslator` class
99+and global `pht()` function built on top of it.
1010+1111+Developers are supposed to call `pht()` on all strings that require translation.
1212+1313+Phabricator provides translations for this translator through
1414+@{class:PhabricatorTranslation} class.
1515+1616+= Adding a New Translation =
1717+1818+Adding a translation which uses the same language rules as some already existing
1919+translation is relatively simple: Just extend @{class:PhabricatorTranslation}
2020+and you will be able to specify this class in the global configuration
2121+'translation.provider' and users will be able to select it in their preferences.
2222+2323+= Adding a New Language =
2424+2525+Adding a language involves all steps as adding a translation plus specifying the
2626+language rules in `PhutilTranslator::chooseVariant()`.
2727+2828+= Singular and Plural =
2929+3030+Different languages have various rules for using singular and plural. All you
3131+need to do is to call `pht()` with a text that is suitable for both forms.
3232+Example:
3333+3434+ pht('%d beer(s)', $count);
3535+3636+Translators will translate this text for all different forms the language uses:
3737+3838+ // English translation
3939+ array('%d beer', '%d beers');
4040+4141+ // Czech translation
4242+ array('%d pivo', '%d piva', '%d piv');
4343+4444+The ugly identifier passed to `pht()` will remain in the text only if the
4545+translation doesn't exist.
4646+4747+= Male and Female =
4848+4949+Different languages use different words for talking about males, females and
5050+unknown genders. Callsites have to call `pht()` passing @{class:PhabricatorUser}
5151+(or other implementation of `PhutilPerson`) if talking about the user. Example:
5252+5353+ pht('%s wrote', $actor);
5454+5555+Translators will create this translations:
5656+5757+ // English translation
5858+ '%s wrote';
5959+6060+ // Czech translation
6161+ array('%s napsal', '%s napsala');