marius-wieschollek / passwords

A simple, yet feature rich password manager for Nextcloud
GNU Affero General Public License v3.0
215 stars 45 forks source link

the file named settings, it not matched chinese simplified, it request the source "zh_Hans_CN.json" #458

Closed LoveWaguan closed 2 years ago

LoveWaguan commented 2 years ago

System Information

Server:

 Nextcloud Version:21.0.4.1
 PHP Version:7.4.16
 Database and Version:
 Server OS and Version: Ubuntu 21.04 
 Passwords Version:2021.11.20

Client:

 Browser and Version:
 Client OS and Version:

Steps to reproduce

Expected result

it should request the source file "zh_CN.js"

Actual result

The Settings page is not displayed in Chinese

Nextcloud log

Nextcloud log ``` {"reqId":"BN4pYAcyDtLRvJfeEVCu","level":4,"time":"2021-12-07T08:13:51+00:00","remoteAddr":"127.0.0.1","user":"--","app":"deck","method":"GET","url":"/nextcloud/index.php/apps/passwords/l10n/settings/zh_Hans_CN.json","message":{"Exception":"Exception","Message":"Cannot include autoload. Did you run install dependencies using composer?","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":125,"function":"register","class":"OCA\\Deck\\AppInfo\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":82,"function":"registerApps","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":634,"function":"runInitialRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":1076,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":35,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/deck/lib/AppInfo/Application.php","Line":109,"CustomMessage":"Error during app service registration: Cannot include autoload. Did you run install dependencies using composer?"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36","version":"21.0.4.1"} ```

Browser log

Browser log ``` GET https://127.0.0.1/nextcloud/index.php/apps/passwords/l10n/settings/zh_Hans_CN.json 404 (Not Found) ```
marius-wieschollek commented 2 years ago

I can confirm, it uses the locale instead of the language as filename. I have pushed a nightly release which fixes that

LoveWaguan commented 2 years ago

bad, it request the variable locale first, if it exists then will return it; but there no "zh_Hans_China" or "zh_Hans" files in your project The code in your project : get lang() { let language = getLanguage(); if(!language) return 'en'; if(language.indexOf('-') !== -1) { return language.substr(0, language.indexOf('-')); } return language; }

get locale() {
    let locale = getLocale();
    if(locale) return locale;
    let language = getLanguage();
    if(language) return language.replace('-', '_');
    return 'en';
}

I mean you should request language firstly,it will get "zh_CN"; it will be work these lcales :

zh Chinese zh_Hans Chinese (Simplified) zh_Hans_CN Chinese (Simplified, China) zh_Hans_HK Chinese (Simplified, Hong Kong SAR China) zh_Hans_MO Chinese (Simplified, Macao SAR China) zh_Hans_SG Chinese (Simplified, Singapore) zh_Hant Chinese (Traditional)
zh_Hant_HK Chinese (Traditional, Hong Kong SAR China) zh_Hant_MO Chinese (Traditional, Macao SAR China) zh_Hant_TW Chinese (Traditional, Taiwan)

these langues: zh_CN 简体中文 zh_TW 中国台湾 zh_HK 中国香港

marius-wieschollek commented 2 years ago

This should be fixed with the latest update.