-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
[Feature] Improve legal code language selection/fallback #483
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run the static analysis tools and resolve any issues identified (./dev/tools.sh
).
There are also a few test failures (run tests with ./dev/coverage.sh
)
@@ -253,20 +253,30 @@ def map_legacy_to_django_language_code(legacy_language_code: str) -> str: | |||
return django_language_code | |||
|
|||
|
|||
def get_default_language_for_jurisdiction_deed(jurisdiction_code): | |||
def get_default_language_for_jurisdiction_deed_ux(jurisdiction_code): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function rename is incomplete:
legal_tools/tests/test_views.py
464: language_default = get_default_language_for_jurisdiction_deed(None)
legal_tools/management/commands/publish.py
490: ] = get_default_language_for_jurisdiction_deed(
@@ -310,7 +320,8 @@ def load_deeds_ux_translations(): | |||
that meet or exceed the TRANSLATION_THRESHOLD). | |||
""" | |||
deeds_ux_po_file_info = {} | |||
languages_mostly_translated = [] | |||
# languages_mostly_translated = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to remove instead of comment out
@manulthanura thank you for this work! There's a few items to resolve before I can properly verify it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the updates.
@manulthanura Please also fix the checklist formatting in the pull request (PR) description |
Closing due to inactivity |
Fixes
Description
This pull request addresses the improvement of the legal code language selection and fallback logic in the
cc-legal-tools-app
. The current fallback mechanism for legal code translations uses a naive method, which has been updated to a more robust approach similar to the Deeds & UX translation logic.The changes include:
load_legal_code_translations()
to populate available legal code translations.get_default_language_for_jurisdiction_naive()
function withget_default_language_for_jurisdiction_legal_code()
for a more sophisticated fallback logic based on the newly addedsettings.LANGUAGES_AVAILABLE_LEGAL_CODE
.get_default_language_for_jurisdiction_deed()
toget_default_language_for_jurisdiction_deed_ux()
to clarify its scope.Technical details
load_legal_code_translations()
function populatessettings.LANGUAGES_AVAILABLE_LEGAL_CODE
with the available languages for each jurisdiction.settings.LANGUAGES_AVAILABLE_LEGAL_CODE
. If not, it falls back to the default language specified in thesettings.LANGUAGE_CODE
.Tests
To verify:
settings.LANGUAGES_AVAILABLE_LEGAL_CODE
.Checklist
Update index.md
).main
ormaster
).visible errors.
Developer Certificate of Origin
For the purposes of this DCO, "license" is equivalent to "license or public domain dedication," and "open source license" is equivalent to "open content license or public domain dedication."
Developer Certificate of Origin