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

Add MODELTRANS_DEFAULT_LANGUAGE setting #117

Merged
merged 5 commits into from
Jul 1, 2024

Conversation

jacobwegner
Copy link
Contributor

See use case in #116.

I worked with the existing test suite using the following patch and verified that everything still passed as expected:

diff --git a/tests/app/settings.py b/tests/app/settings.py
index a0adb93..5229cd3 100644
--- a/tests/app/settings.py
+++ b/tests/app/settings.py
@@ -90,8 +90,8 @@ DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
 # Internationalization
 # https://docs.djangoproject.com/en/1.11/topics/i18n/
 
-LANGUAGE_CODE = "en"
-
+LANGUAGE_CODE = "en-US"
+MODELTRANS_DEFAULT_LANGUAGE = "en"
 MODELTRANS_AVAILABLE_LANGUAGES = ("nl", "de", "fr")
 
 TIME_ZONE = "UTC"

I also added DefaultLanguageConfTest to verify that settings override got picked up.

Please let me know if there are any additional tests / documentation that would be required.

Copy link
Member

@jieter jieter left a comment

Choose a reason for hiding this comment

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

The use case seems to be fair, and the implementation doesn't add much complexity 👍

I think we should add this setting to the documentation. Can you extend the PR with documentation for this setting?

@jacobwegner jacobwegner force-pushed the task/configure-default-lang branch from da2b52d to 4ecb809 Compare June 27, 2024 19:39
@jacobwegner
Copy link
Contributor Author

@jieter Thanks for the feedback. I did a pass to update the documentation and link to #116 for more context.

Copy link
Member

@jieter jieter left a comment

Choose a reason for hiding this comment

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

One last nitpick, and a test failure (slightly annoying false positive in the spell check, "middlewares" need to be added to https://github.com/zostera/django-modeltrans/blob/master/docs/spelling_wordlist.txt)

I'll merge and create a new release after these are resolved...

docs/pages/settings.rst Outdated Show resolved Hide resolved
@jacobwegner jacobwegner force-pushed the task/configure-default-lang branch from b32e8bd to 4cfa7a5 Compare July 1, 2024 12:20
Copy link
Member

@jieter jieter left a comment

Choose a reason for hiding this comment

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

Thanks!

@jieter jieter merged commit 6d66c21 into zostera:master Jul 1, 2024
20 checks passed
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.

2 participants