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

Load the english file again in case BS table doesn’t have a translation #15133

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

snipe
Copy link
Owner

@snipe snipe commented Jul 22, 2024

We were seeing an issue where if the user selected a language that the Bootstrap Table library didn't have translated yet, it would default the table translations ("Show page x of y", etc) to Chinese. Per their docs:

Locale files must be pre-loaded. Allows for fallback locales, if loaded, in the following order:

  1. First tries for the locale as specified,
  2. Then tries the locale with ‘_’ translated to ‘-‘ and the region code upper cased,
  3. Then tries the short locale code (i.e. 'zh' instead of 'zh-CN'),
  4. And finally will use the last locale file loaded (or the default locale if no locales loaded).

If left undefined or an empty string, use the last locale loaded (or 'en-US' if no locale files loaded).

So what was happening is that the table would look for a language in the bootstrap tables bootstrap-table-locale-all.min.js, and if it couldn't find it, it was defaulting to the last locale loaded, which alphabetically would end up being zh-TW.

This change loads en-US up after the bootstrap-table-locale-all.min.js (even though English is already loaded via the "all" version" so that it will be the "last loaded".

It's a bit hacky but it seems to work.

Copy link

what-the-diff bot commented Jul 22, 2024

PR Summary

  • New File Addition for Enhanced User Interface
    The addition of a new JavaScript file named "bootstrap-table-en-US.min.js" has been made. This file contains specific improvements for the user interface, dealing primarily with tables in the application. It was added in three different paths of our project.
  • In the first path, the file was listed in "mix-manifest.json". This document helps to manage versioning and caching for our assets.
  • In the second path, the file was included in a PHP blade template called "bootstrap-table.blade.php". This will allow any tables created in this specific template to benefit from the improved interface features.
  • Lastly, in the third path, the file was referenced in "webpack.mix.js". This will ensure that during our build process, this important file is included for the ultimate deployment of the application.

This new file will allow us to present data in tables more effectively, creating a better user experience.

@snipe snipe merged commit 4623e40 into develop Jul 22, 2024
8 of 9 checks passed
@snipe snipe deleted the fixes/load_english_separately_for_table_locale branch July 22, 2024 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant