Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/pat/select2/select2.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ export default Base.extend({
await import("select2");
try {
// Don't load "en" which is the default where no separate language file exists.
if (this.options.language && this.options.language !== "en") {
await import(`select2/select2_locale_${this.options.language}`);
if (this.options.language && this.options.language !== "en" && !this.options.language.startsWith("en")) {
let lang = this.options.language.split("-");
// Fix for country specific languages
lang = (lang.length > 1) ? `${lang[0]}-${lang[1]}` : lang[0];
await import(`select2/select2_locale_${lang}`);
}
} catch {
console.warn("Language file could not be loaded", this.options.language);
Expand Down