- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 135
 
Open
Labels
help wantedOpen to participation from the communityOpen to participation from the community✨ goal: improvementImprovement to an existing featureImprovement to an existing feature🏁 status: ready for workReady for workReady for work💻 aspect: codeConcerns the software code in the repositoryConcerns the software code in the repository🕹 aspect: interfaceConcerns end-users' experience with the softwareConcerns end-users' experience with the software🟩 priority: lowLow priority and doesn't need to be rushedLow priority and doesn't need to be rushed
Description
Problem
The language selection/fallback for Deeds & UX is robust:
- https://github.com/creativecommons/cc-legal-tools-app/blob/1906900d05b00367024c05b92f8b103c5044e9d7/i18n/utils.py#L307C1-L335
 cc-legal-tools-app/i18n/utils.py
Lines 256 to 263 in 1906900
def get_default_language_for_jurisdiction_deed(jurisdiction_code): default_language = DEFAULT_JURISDICTION_LANGUAGES.get( jurisdiction_code, settings.LANGUAGE_CODE ) if default_language in settings.LANGUAGES_MOSTLY_TRANSLATED: return default_language else: return settings.LANGUAGE_CODE 
However, logic for the legal code translation domains use a naive version:
cc-legal-tools-app/i18n/utils.py
Lines 266 to 269 in 1906900
def get_default_language_for_jurisdiction_naive(jurisdiction_code): return DEFAULT_JURISDICTION_LANGUAGES.get( jurisdiction_code, settings.LANGUAGE_CODE ) 
Description
- Add a new function (ex. 
load_legal_code_translations()) that populate a new variable (ex.settings.LANGUAGES_AVAILABLE_LEGAL_CODE)- (much like the 
load_deeds_ux_translations()function) 
 - (much like the 
 get_default_language_for_jurisdiction_naive()->get_default_language_for_jurisdiction_legal_code()- The 
get_default_language_for_jurisdiction_naive()function should be replaced with aget_default_language_for_jurisdiction_legal_code()function - The new function should rely on a setting variable (ex. 
settings.LANGUAGES_AVAILABLE_LEGAL_CODE)- (much like the 
get_default_language_for_jurisdiction_deed()function relies onsettings.LANGUAGES_MOSTLY_TRANSLATED) 
 - (much like the 
 
- The 
 get_default_language_for_jurisdiction_deed()->get_default_language_for_jurisdiction_deed_ux()- The 
get_default_language_for_jurisdiction_deed()function should be renamed toget_default_language_for_jurisdiction_deed_ux() - (the scope is the Deeds & UX translation domain, not specifically the deeds)
 
- The 
 settings.LANGUAGES_MOSTLY_TRANSLATED->settings.LANGUAGES_AVAILABLE_DEEDS_UX- The 
settings.LANGUAGES_MOSTLY_TRANSLATEDvariable should be rename tosettings.LANGUAGES_AVAILABLE_DEEDS_UX - (the scope is the Deeds & UX translation domain, not specifically the deeds)
 
- The 
 
Additional context
- App: Fix missing canonical URLs #446
- (added the 
get_default_language_for_jurisdiction_naive()function) 
 - (added the 
 
Implementation
- I would be interested in implementing this feature.
 
Metadata
Metadata
Assignees
Labels
help wantedOpen to participation from the communityOpen to participation from the community✨ goal: improvementImprovement to an existing featureImprovement to an existing feature🏁 status: ready for workReady for workReady for work💻 aspect: codeConcerns the software code in the repositoryConcerns the software code in the repository🕹 aspect: interfaceConcerns end-users' experience with the softwareConcerns end-users' experience with the software🟩 priority: lowLow priority and doesn't need to be rushedLow priority and doesn't need to be rushed
Type
Projects
Status
Backlog