Fixes #448 : Improve legal code language selection/fallback #501
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes
Description
This pull request implements new functionality for managing legal code translations in the system, addressing the need for:
settings.LANGUAGES_AVAILABLE_LEGAL_CODE
variable with legal code translations using a new functionload_legal_code_translations()
.get_default_language_for_jurisdiction_legal_code()
to determine the default language for a given jurisdiction, considering the available legal code translations.get_default_language_for_jurisdiction_deed()
toget_default_language_for_jurisdiction_deed_ux()
.settings.LANGUAGES_MOSTLY_TRANSLATED
tosettings.LANGUAGES_AVAILABLE_DEEDS_UX
.These additions align with the existing structure for deeds and UX translations, ensuring consistency across the system.
Technical details
New Functions
load_legal_code_translations()
get_legal_code_pofiles()
.settings.TRANSLATION_THRESHOLD
.settings.LANGUAGES_AVAILABLE_LEGAL_CODE
with languages meeting the criteria.settings.DEEDS_UX_PO_FILE_INFO
.get_default_language_for_jurisdiction_legal_code()
DEFAULT_JURISDICTION_LANGUAGES
to determine the default language for a jurisdiction.settings.LANGUAGE_CODE
if the language is unavailable insettings.LANGUAGES_AVAILABLE_LEGAL_CODE
.get_legal_code_pofiles()
settings.LEGAL_CODE_LOCALE_PATH
.Key Updates
settings.LANGUAGES_AVAILABLE_LEGAL_CODE
is dynamically populated during runtime for accurate jurisdiction language lookups.get_default_language_for_jurisdiction_naive()
function with aget_default_language_for_jurisdiction_legal_code()
function.settings.LANGUAGES_AVAILABLE_DEEDS_UX
tosettings.LANGUAGES_AVAILABLE_DEEDS_UX
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