Improve translation documentation
This commit is contained in:
@@ -32,12 +32,29 @@ How to add new translated text in the application?
|
|||||||
|
|
||||||
Translations are displayed with the following functions in the source code:
|
Translations are displayed with the following functions in the source code:
|
||||||
|
|
||||||
- `t()`: escaped HTML text
|
- `t()`: dispaly text with HTML escaping
|
||||||
- `e()`: displayed with no escaping
|
- `e()`: display text without HTML escaping
|
||||||
- `dt()`: date using `strftime()` formats
|
- `dt()`: display date and time using the `strftime()` function formats
|
||||||
|
|
||||||
Always use the english version in the source code.
|
Always use the english version in the source code.
|
||||||
|
|
||||||
|
### Date and time translation
|
||||||
|
|
||||||
|
Date strings use the function `strftime()` to format the date.
|
||||||
|
|
||||||
|
By example, the original English version can be defined like that `Created on %B %e, %Y at %k:%M %p` and that will output something like that `Created on January 11, 2015 at 15:19 PM`. The French version can be modified to display a different format, `Créé le %d/%m/%Y à %H:%M` and the result will be `Créé le 11/01/2015 à 15:19`.
|
||||||
|
|
||||||
|
All formats are available in the [PHP documentation](http://php.net/strftime).
|
||||||
|
|
||||||
|
### Placeholders
|
||||||
|
|
||||||
|
Text strings use the function `sprintf()` to replace elements:
|
||||||
|
|
||||||
|
- `%s` is used to replace a string
|
||||||
|
- `%d` is used to replace an integer
|
||||||
|
|
||||||
|
All formats are available in the [PHP documentation](http://php.net/sprintf).
|
||||||
|
|
||||||
How to find missing translations in the applications?
|
How to find missing translations in the applications?
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user