From 2df8ef7272a9b3df43cadeb2ce3f4219ce032495 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 5 May 2015 00:50:47 +0200 Subject: [PATCH] Document how to change translations within a theme * applies for 8.0+ --- developer_manual/core/theming.rst | 48 +++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/developer_manual/core/theming.rst b/developer_manual/core/theming.rst index fc5a76f08..ec2215ea2 100644 --- a/developer_manual/core/theming.rst +++ b/developer_manual/core/theming.rst @@ -43,9 +43,9 @@ Structure ========= The folder structure of a theme is exactly the same as the main ownCloud -structure. You can override js files, images and templates with own versions. -CSS files are loaded additionally to the default files so you can override CSS -properties. +structure. You can override js files, images, translations and templates with +own versions. CSS files are loaded additionally to the default files so you can +override CSS properties. How to change images and the logo @@ -112,6 +112,48 @@ The other major color scheme is the blue header bar on the main navigation page This color we will change with the above as well. Save the file and refresh the browser for the changes to take effect. +How to change translations +========================== + +.. versionadded 8.0 + +You can override the translation of single strings within your theme. Simply +create the same folder structure within your theme folder for the language file +you want to override. Only the changed strings need to be added to that file for +all other terms the shipped translation will be used. + +If you want to override the translation of the term "Download" within the +``files`` app for the language ``de`` you need to create the file +``themes/THEME_NAME/apps/files/l10n/de.js`` and put the following code in: + +.. code-block:: js + + OC.L10N.register( + "files", + { + "Download" : "Herunterladen" + }, + "nplurals=2; plural=(n != 1);" + ); + +Additionally you need to create another file +``themes/THEME_NAME/apps/files/l10n/de.json`` with the same translations that +look like this: + +.. code-block:: json + + { + "translations": { + "Download" : "Herunterladen" + }, + "pluralForm" :"nplurals=2; plural=(n != 1);" + } + +Both files (``.js`` and ``.json``) are needed with the same translations, +because the first is needed to enable translations in the JavaScript code and +the second one is read by the PHP code and provides the data for translated +terms in there. + Testing the new theme out =========================