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

Error in DataTables localized output text (error introduced in MRBS version 1.11.3) (Solved) #3502

Closed
Langveisfra opened this issue Sep 9, 2023 · 28 comments
Labels
bug Something isn't working

Comments

@Langveisfra
Copy link

The top and the bottom of the table showing the result of a search is displayed in English, even though the MRBS is forced to show another language. The terms that are not translated are present in the lang.xx-file.

The error was not present in MRBS version 1.4.9, but occurs in 1.11.3.

Running:
10.3.37-MariaDB
Apache/2.4.57 (Unix)
PHP | 8.2.5

image

@Langveisfra Langveisfra added the bug Something isn't working label Sep 9, 2023
@Langveisfra
Copy link
Author

Showing the non-translated items:
image

@campbell-m
Copy link
Contributor

I think it actually works OK in 1.11.3, but not in the latest development code.

The problem is that in the latest development code, which uses the latest DataTables library, there is only a sv-SE.json file. (In 1.11.3 and earlier, where the previous versions of DataTables used a different set of language files, there was a Swedish.lang file). In the short term you could fix your system by copying jquery/datatables/language/sv-SE.json to sv.json.

As for the proper fix I think there are a number of options:

  1. Submit a PR to the DataTables team to provide a sv.json file; and/or
  2. Allow $override_locale to be an array; and/or
  3. Change the algorithm that searches for the best language file to fall back to 'sv-SE' if it cannot find 'sv'.

The last two options require a bit more thought though.

@campbell-m
Copy link
Contributor

I've raised an issue on the DataTables Plugins.

@campbell-m
Copy link
Contributor

The other workaround, assuming that at the moment you have $override_locale = 'sv'; is to set $override_locale = 'sv-SE'; instead.

@Langveisfra
Copy link
Author

I put $override_locale = 'sv-SE'; in the config.inc.php file without success. Should it be placed elsewhere?

@campbell-m
Copy link
Contributor

No, that's where it should go. I'm not sure whether you are running 1.11.3 or the latest development code. If you are running 1.11.3 I would recommend upgrading to the latest development code. You can download the files by following the green Code button on this page. Treat it like an upgrade.

@campbell-m
Copy link
Contributor

No, I misunderstood. It means you are in fact running 1.11.3. I recommend that you upgrade to the latest development code as described above.

@Langveisfra Langveisfra changed the title search.php only partly translatable Tables only partly translated/Error in localization of DataTables output text Sep 11, 2023
@Langveisfra
Copy link
Author

The not-translates terms resides in the files of this folder: mrbs/jquery/datatables/language/[Language].lang
The language files seems not to be accessed, with or without stating $override_locale = '[languagecode]'; in the config.inc.php file

@campbell-m
Copy link
Contributor

Have you upgraded to the latest development code?

@Langveisfra
Copy link
Author

No, not yet. Maybe I'll try it tonight. Does it alter the sql-database so that I can not revert to the ordinary 1.11.3 release?
Have you tried the dev. release with success regarding table text translation?

@campbell-m
Copy link
Contributor

No, it won't alter the database. Yes, I've tested it successfully with $override_locale = 'sv-SE';.

@Langveisfra
Copy link
Author

Strange things. I did install the dev. version, leaving the $override_locale = 'sv-SE'; as the only language pref. (Commented out $faqfilelang - $disable_automatic_language_changing - $default_language_tokens)
All is still showing in Swedish - except from the tables top and bottom text, as circled in red above.

@Langveisfra
Copy link
Author

Langveisfra commented Sep 11, 2023

After restarting the webserver (apache running on Synology) it worked. Thank you!

@Langveisfra
Copy link
Author

But alas, after renaming the web folder containing the MRBS's web files - it's back to normal: All Swedish except the DataTables text, which still is English.

@campbell-m
Copy link
Contributor

Try doing a hard refresh of your browser, or else using a different browser. It's possible that your browser is using a cached version of the JavaScript file.

@Langveisfra
Copy link
Author

Langveisfra commented Sep 11, 2023

New browser (that never have visited the site on beforehand) = no luck. Downgrading to MRBS 1.11.2 = huge success :-) It seems to me that this bug (failing to consistently show localized text elements in DataTables) was introduced in version 1.11.3 and still persists in det dev version.
The system demo, running version 1.11.1 also shows translated text fine.

@campbell-m
Copy link
Contributor

What are your settings of $disable_automatic_language_changing, $default_language_tokens and $override_locale?

Also, what are your browser's language preferences (as shown on the MRBS Help page)?

@Langveisfra Langveisfra changed the title Tables only partly translated/Error in localization of DataTables output text Error in DataTables localized output text (error introduced with MRBS version 1.11.3) Sep 11, 2023
@Langveisfra Langveisfra changed the title Error in DataTables localized output text (error introduced with MRBS version 1.11.3) Error in DataTables localized output text (error introduced in MRBS version 1.11.3) Sep 11, 2023
@campbell-m
Copy link
Contributor

Can you try the attached version of js/datables.js.php with the latest development version? You'll need to unzip the file first.
datatables.js.zip

@jberanek
Copy link
Member

jberanek commented Sep 11, 2023

New browser (that never have visited the site on beforehand) = no luck. Downgrading to MRBS 1.11.2 = huge success :-) It seems to me that this bug (failing to consistently show localized text elements in DataTables) was introduced in version 1.11.3 and still persists in det dev version. The system demo, running version 1.11.1 also shows translated text fine.

Hi, I've solved the "issue" of the demo site having an old version of MRBS, it is now running 1.11.3.

This site is running the tip of the 'main' branch up until just now, when I pulled the latest code:
https://mrbsdemo.uk.to/mrbs-tip/

@campbell-m
Copy link
Contributor

I note that the demo site running 1.11.3 works properly when I have my browser language set to 'sv', but the tip doesn't (as I would expect).

@Langveisfra
Copy link
Author

Can you try the attached version of js/datables.js.php with the latest development version? You'll need to unzip the file first. datatables.js.zip

Tried your attached file. Still English titles above and below the table.

@Langveisfra
Copy link
Author

I note that the demo site running 1.11.3 works properly when I have my browser language set to 'sv', but the tip doesn't (as I would expect).

Same result for me. One works, the other doesn't.

campbell-m added a commit that referenced this issue Sep 11, 2023
…ch are copies of the main country specific version (eg fr.json is a copy of fr-FR.json). See GitHub Issue #3502.
@campbell-m
Copy link
Contributor

I've now added in 56b28ca some basic language versions which should make the tip, when updated, work with 'sv'.

@campbell-m
Copy link
Contributor

Tried your attached file. Still English titles above and below the table.

Did you do a hard refresh of the browser?

Can you have a look in your browser's development tools and see if there are any errors in (a) the console and (b) the network tabs?

Also, if your site is on the internet and you are willing to give me a link, could you send me a PM? If not, I quite understand.

@campbell-m
Copy link
Contributor

What are your settings of $disable_automatic_language_changing, $default_language_tokens and $override_locale?

Also, what are your browser's language preferences (as shown on the MRBS Help page)?

Don't know if you had a chance to look at these?

@Langveisfra
Copy link
Author

Campbell-m: I have sent you a message.

@campbell-m
Copy link
Contributor

OK, it hasn't arrived yet, but I'll look out for it.

@campbell-m
Copy link
Contributor

Now working. It seems that the problem was caused by not having the most up-to-date language.inc file on the web server.

@Langveisfra Langveisfra changed the title Error in DataTables localized output text (error introduced in MRBS version 1.11.3) Error in DataTables localized output text (error introduced in MRBS version 1.11.3) (Solved) Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants