3

Is it possible to localize a file that is overridden by a custom theme in ownCloud?

According to this issue in the bugtracker you can override theme files by just placing them in your own theme folder and editing them. In the case of the email templates, that are sent when you share a file with someone this looks like this:

print_unescaped($l->t("Hey there,\n\njust letting you know that %s shared %s with you.\nView it: %s\n\n", array($_['user_displayname'], $_['filename'], $_['link'])));

This relies on the localization feature, so when I change this text it will only be displayed in English, because the new text is not available in the language files.

I found localization files in <owncloud>/core/l10n/de_DE.php, which look like this:

$TRANSLATIONS = array(
"%s shared »%s« with you" => "%s hat »%s« mit Ihnen geteilt",
"Couldn't send mail to following users: %s " => "An folgende Benutzer konnte keine E-Mail gesendet werden: %s",
// ...
);

I assume that I could copy this file over to my theme directory too and add my translation for the new text, but that way I would lose future changes in the original localization file.

What I would like to have is the possibility to append (and ideally override) entries to the $TRANSLATIONS array in my theme directory.

The official documentation about theming is not up to date (it looks like it has been copied from the previous version without adapting it to changes) and does't cover localization at all. The documentation about translation is not helpful either.

Gerald Schneider
  • 19,757
  • 8
  • 52
  • 79

1 Answers1

1

With the release of ownCloud 7, you can edit the e-mail templates via the admin control panel. About localisation of your text on this link it is well explained how you can generate new language files.

In case the link goes down: Make text translatable In HTML or PHP wrap it like this <?php p($l->t('This is some text'));?> or this <?php print_unescaped($l->t('This is some text'));?> For the right date format use <?php p($l->l('date', time()));?>. Change the way dates are shown by editing /core/l10n/l10n-[lang].php To translate text in javascript use: t('appname','text to translate');

Brantje
  • 76
  • 1
  • 3