mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +03:00
[Docs] Update Plugin Docs
This commit is contained in:
parent
c62592e95e
commit
10be2c2031
10
PLUGINS.md
10
PLUGINS.md
@ -1193,19 +1193,17 @@ widget if you need to display routine status information.
|
|||||||
## Localisation
|
## Localisation
|
||||||
|
|
||||||
You can localise your plugin to one of the languages that EDMarketConnector
|
You can localise your plugin to one of the languages that EDMarketConnector
|
||||||
itself supports. Add the following boilerplate near the top of each source
|
itself supports. Add the following import near the top of each source
|
||||||
file that contains strings that needs translating:
|
file that contains strings that needs translating:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import l10n
|
from l10n import translations as tr
|
||||||
import functools
|
|
||||||
_ = functools.partial(l10n.Translations.translate, context=__file__)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Wrap each string that needs translating with the `_()` function, e.g.:
|
Wrap each string that needs translating with the `tr.tl()` function, e.g.:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
somewidget["text"] = _("Happy!")
|
somewidget["text"] = tr.tl("Happy!")
|
||||||
```
|
```
|
||||||
|
|
||||||
If you display localized strings in EDMarketConnector's main window you should
|
If you display localized strings in EDMarketConnector's main window you should
|
||||||
|
Loading…
x
Reference in New Issue
Block a user