You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+76-10Lines changed: 76 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,43 +19,110 @@ npm i -S @nextcloud/l10n
19
19
20
20
## Usage
21
21
22
-
### OC.L10n abstraction
22
+
### With Nextcloud based translations
23
23
24
-
You can use helpers in this package in order generate code that also works when it's not loaded on a Nextcloud page. This is primary useful for testing. The logic will just return the original string if the global variable `OC` isn't found.
24
+
Apps normally use the Nextcloud provided translation mechanism which allows to translate backend (PHP) strings together with the frontend.
25
+
This can either be done using the Nextcloud Transifex automatization or translations can be done manually.
26
+
See the [localization docs](https://docs.nextcloud.com/server/stable/developer_manual/basics/front-end/l10n.html) for how to setup.
25
27
26
-
In order to not break the l10n string extraction scripts, make sure to alias the imported function to match the legacy syntax:
28
+
When using the Nextcloud translation system (manually or with automated Transifex) Nextcloud will automatically
29
+
register the translations on the frontend.
30
+
In this case all you have to do is to import the translation functions from this package like shown below:
You can use this package to translate your app or library independent of Nextcloud. For that you need .po(t) files. These can be extracted with [gettext-extractor](https://github.com/lukasgeiter/gettext-extractor).
83
+
It is also possible to use this package for Nextcloud independent translations.
84
+
This is mostly useful for libraries that provide translated strings.
85
+
86
+
Independent means you can use this without Nextcloud registered translations buy just providing your `.po` files.
87
+
If you decide to use this way you have to extract the translation strings manually, for example using the [gettext-extractor](https://github.com/lukasgeiter/gettext-extractor).
0 commit comments