Skip to content

Conversation

@Frohus
Copy link

@Frohus Frohus commented Jul 19, 2024

GH-319 only fixed the issue for en_US while it persists for en_GB.
It doesn't seem to be causing any issues, it's just seeing Not Found: /static/tinymce/langs/en_GB.js in the console on every page load with TinyMCE widget is annoying.

I guess it could be extended to every English language variation by doing something like:

if mce_config["language"][:2] == "en":

but I'm not an expert on that so I'd appreciate somebody else's input.

if "language" not in mce_config:
mce_config["language"] = get_language_from_django()
if mce_config["language"] == "en_US":
if mce_config["language"] in ["en_GB", "en_US"]:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about startswith("en_") to cover all variants?
(unless the language param can only be GB or US, not CA or all the other possibilities)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's the right fix, as someone can provide a custom en_* translation file and this fix would ignore that custom file. I think we should instead fix match_language_with_tinymce and replace if lang.startswith("en") with if lang == 'en_US' at the start of the function, so any en_* variant will go through the standard search for an existing tinyMCE language file.

if "language" not in mce_config:
mce_config["language"] = get_language_from_django()
if mce_config["language"] == "en_US":
if mce_config["language"] in ["en_GB", "en_US"]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's the right fix, as someone can provide a custom en_* translation file and this fix would ignore that custom file. I think we should instead fix match_language_with_tinymce and replace if lang.startswith("en") with if lang == 'en_US' at the start of the function, so any en_* variant will go through the standard search for an existing tinyMCE language file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants