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

Do not attempt to load en_GB langauge #474

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

@@ -55,7 +55,7 @@ def get_mce_config(self, attrs):
mce_config = tinymce.settings.DEFAULT_CONFIG.copy()
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.

@@ -55,7 +55,7 @@ def get_mce_config(self, attrs):
mce_config = tinymce.settings.DEFAULT_CONFIG.copy()
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