Forgot Password
 Register
View: 11|Reply: 1

Discuz! X5.0 Language Switcher Issues

[Copy Link]
Posted on day before yesterday 12:50 | Show all floors |Read Mode
I encountered an issue. Could someone please help take a look:
Steps to reproduce:
  • Added a new language pack (EN_UTF8, already uploaded to the /source/i18n/ directory) in the admin panel: Templates → Language Packs → Activate.
  • Cleared the cache: Tools → Update Cache.
  • The language pack can be switched on the frontend, but cannot log in.

From the browser logs, I see that the page is requesting a non-existent file at this path: /static/js/lang_EN_UT8.js. Sometimes it's another file: /static/js/lang_default.js.
I suspect the issue is in this section of /static/js/common.js:
  1. var _i18n_ = 'default';
  2. if (typeof IN_ADMINCP == 'undefined') {
  3.         try {
  4.                 var _i18n_ = getcookie('i18n');
  5.                 _i18n_ = !_i18n_ ? 'default' : _i18n_;
  6.         } catch (e) {
  7.         }
  8. }

  9. var _JSLANG_ = new Array();
  10. try {
  11.         _JSLANG_ = JSON.parse(loadUserdata('i18n_' + _i18n_));
  12. } catch (e) {
  13.         _JSLANG_ = new Array();
  14. }
  15. if (!_JSLANG_ || _JSLANG_['_verhash_'] != VERHASH) {
  16.         var _script_ = document.createElement("script");
  17.         _script_.type = "text/javascript";
  18.         _script_.src = (typeof (JSCACHEPATH) == 'undefined' ? JSPATH : JSCACHEPATH) + 'lang_' + _i18n_ + '.js?' + VERHASH;
  19.         document.head.appendChild(_script_);
  20.         _script_.onload = function () {
  21.                 _JSLANG_['_verhash_'] = VERHASH;
  22.                 saveUserdata('i18n_' + _i18n_, JSON.stringify(_JSLANG_));
  23.         };
  24. }
Copy Code


Reply

Use Props Report

 Thread Author| Posted on day before yesterday 15:16 | Show all floors
Problem Solved:
Just add one more configuration in config/config_global.php

  1. $_config['output']['jsref'] = 'data/cache';
Copy Code


JSCACHEPATH the parameter is used in static/js/common.js
  1. //turn on i18n multilanguage version
  2. var JSCACHEPATH = 'data/cache/';
Copy Code

Reply

Use Props Report

You need to log in before you can reply Login | Register

Forum Credit Rules

Close

Editors SelectedPrevious /2 Next

Archiver|Mobile|Darkroom|Privacy|DSC

GMT+7, 2026-04-10 04:03 , Processed in 0.010922 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

Quick Reply Back to Top Return to List