Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with .js translation files and global t() helper within applications #10959

Closed
moblue7 opened this issue Sep 2, 2018 · 4 comments
Closed
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: language l10n and translations

Comments

@moblue7
Copy link

moblue7 commented Sep 2, 2018

When I change the language from English to another supported language, the php translation files (.json) work properly. However, inside the l10n folder corresponding to the application, there are two types of translation files .json and .js. I have noticed that the labels in .js files never get translated inside the application (for instance contacts application). The nextcloud documentation says we should use t('app_name', 'Label') in order for the right translation of the label to get printed. However, in the case of javascript translations, only the label itself gets printed all the time. I am using nextcloud 13.0.2 and I am experiencing this problem at least in contacts and tasks applications.

Steps to reproduce

  1. change nextcloud language to a supported language
  2. change the corresponding .js translation file in l10n folder of the application and add the required label in your language
  3. use the t('app_name', 'Label') global helper for the right translation to get printed

Expected behaviour

The right translation should get printed corresponding to the selected language.

Actual behaviour

The label itself gets printed in English.

Server configuration

Operating system: Fedora 25

Web server: Apache

Database: MariaDB

PHP version: 7.1

Nextcloud version: 13.0.2

Updated from an older Nextcloud/ownCloud or fresh install: fresh install

Where did you install Nextcloud from: Github

List of activated apps: contacts, tasks, calendar, files

Nextcloud configuration:

$CONFIG = array (
'instanceid' => 'octhji0e1mmi',
'passwordsalt' => ,
'secret' => ,
'trusted_domains' =>
array (
0 => 'nextcloud.local',
),
'datadirectory' => '/home/moblue7/public_html/nextcloud/data',
'overwrite.cli.url' => 'http://nextcloud.local',
'dbtype' => 'mysql',
'version' => '13.0.2.1',
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'dbuser' => 'oc_admin3',
'dbpassword' => ,
'installed' => true,
'updater.release.channel' => 'stable',
'force_language' => 'fa',
'maintenance' => false,
);

Browser: Firefox

@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #2339 (translation problem), #9000 (Problem rewriting SMB files), #8302 (Presentation problem in file actions), #10802 (Problem with actions in trashbin after select all and unselect of some files), and #2359 (Odd German translation for "file drop").

@MorrisJobke
Copy link
Member

We can't reproduce this. The PHP and the JS translations work without problems. What specific strings do you have problems with? Also upgrading your Nextcloud instance helps to get the latest translation strings into the code.

@MorrisJobke MorrisJobke added needs info and removed bug labels Oct 1, 2018
@moblue7
Copy link
Author

moblue7 commented Oct 2, 2018

Hi Morris, thank you for your attention. In nextcloud 13.0.2, when changing to a different language (farsi in our case), the PHP translations work fine, but the js ones don't get translated (none of them) and the translation key in English gets printed. We need to use this version because we are using some apps like rainloop that do not support newer versions of nextcloud. Currently, we are hardcoding the strings we need in our language in js files but if there is a better way to do this we would like to do that. If you can not reproduce this please kindly let us know what may have caused this problem in js translations. It may be something we are missing in our installation and our configuration. We set the default language to "fa" and it did not work. Then we forced "fa" and it did not work either.

@MorrisJobke MorrisJobke self-assigned this Oct 2, 2018
@skjnldsv skjnldsv added the 0. Needs triage Pending check for reproducibility or if it fits our roadmap label Jun 12, 2019
@szaimen
Copy link
Contributor

szaimen commented May 21, 2021

I'm closing this issue due to inactivity. If this is still happening please make sure to upgrade to the latest version. After that, feel free to reopen.

@szaimen szaimen closed this as completed May 21, 2021
@MorrisJobke MorrisJobke removed their assignment May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: language l10n and translations
Projects
None yet
Development

No branches or pull requests

5 participants