1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

Link libphutil docs

This commit is contained in:
vrana 2012-06-18 19:09:27 -07:00
parent 8a8a48cc8f
commit c53ed032c9

View file

@ -5,10 +5,12 @@ What is required from developers to get Phabricator translatable.
= API =
Translator API is provided by libphutil. It gives us `PhutilTranslator` class
and global `pht()` function built on top of it.
Translator API is provided by libphutil. It gives us
@{class@libphutil:PhutilTranslator} class and global @{function@libphutil:pht}
function built on top of it.
Developers are supposed to call `pht()` on all strings that require translation.
Developers are supposed to call @{function@libphutil:pht} on all strings that
require translation.
Phabricator provides translations for this translator through
@{class:PhabricatorTranslation} class.
@ -23,13 +25,13 @@ and you will be able to specify this class in the global configuration
= Adding a New Language =
Adding a language involves all steps as adding a translation plus specifying the
language rules in `PhutilTranslator::chooseVariant()`.
language rules in @{method@libphutil:PhutilTranslator::chooseVariant}.
= Singular and Plural =
Different languages have various rules for using singular and plural. All you
need to do is to call `pht()` with a text that is suitable for both forms.
Example:
need to do is to call @{function@libphutil:pht} with a text that is suitable for
both forms. Example:
pht('%d beer(s)', $count);
@ -41,14 +43,15 @@ Translators will translate this text for all different forms the language uses:
// Czech translation
array('%d pivo', '%d piva', '%d piv');
The ugly identifier passed to `pht()` will remain in the text only if the
translation doesn't exist.
The ugly identifier passed to @{function@libphutil:pht} will remain in the text
only if the translation doesn't exist.
= Male and Female =
Different languages use different words for talking about males, females and
unknown genders. Callsites have to call `pht()` passing @{class:PhabricatorUser}
(or other implementation of `PhutilPerson`) if talking about the user. Example:
unknown genders. Callsites have to call @{function@libphutil:pht} passing
@{class:PhabricatorUser} (or other implementation of
@{interface@libphutil:PhutilPerson}) if talking about the user. Example:
pht('%s wrote', $actor);