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

[Feature] Improve legal code language selection/fallback #448

Open
1 task
TimidRobot opened this issue May 8, 2024 · 0 comments
Open
1 task

[Feature] Improve legal code language selection/fallback #448

TimidRobot opened this issue May 8, 2024 · 0 comments
Labels
💻 aspect: code Concerns the software code in the repository 🕹 aspect: interface Concerns end-users' experience with the software ✨ goal: improvement Improvement to an existing feature help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed 🏁 status: ready for work Ready for work

Comments

@TimidRobot
Copy link
Member

Problem

The language selection/fallback for Deeds & UX is robust:

  1. https://github.com/creativecommons/cc-legal-tools-app/blob/1906900d05b00367024c05b92f8b103c5044e9d7/i18n/utils.py#L307C1-L335
  2. 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:

  1. def get_default_language_for_jurisdiction_naive(jurisdiction_code):
    return DEFAULT_JURISDICTION_LANGUAGES.get(
    jurisdiction_code, settings.LANGUAGE_CODE
    )

Description

  1. 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)
  2. 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 a get_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 on settings.LANGUAGES_MOSTLY_TRANSLATED)
  3. get_default_language_for_jurisdiction_deed() -> get_default_language_for_jurisdiction_deed_ux()
    • The get_default_language_for_jurisdiction_deed() function should be renamed to get_default_language_for_jurisdiction_deed_ux()
    • (the scope is the Deeds & UX translation domain, not specifically the deeds)
  4. settings.LANGUAGES_MOSTLY_TRANSLATED -> settings.LANGUAGES_AVAILABLE_DEEDS_UX
    • The settings.LANGUAGES_MOSTLY_TRANSLATED variable should be rename to settings.LANGUAGES_AVAILABLE_DEEDS_UX
    • (the scope is the Deeds & UX translation domain, not specifically the deeds)

Additional context

Implementation

  • I would be interested in implementing this feature.
@TimidRobot TimidRobot added help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed ✨ goal: improvement Improvement to an existing feature 💻 aspect: code Concerns the software code in the repository 🕹 aspect: interface Concerns end-users' experience with the software labels May 8, 2024
@cc-open-source-bot cc-open-source-bot added the 🏷 status: label work required Needs proper labelling before it can be worked on label May 9, 2024
@TimidRobot TimidRobot added 🏁 status: ready for work Ready for work and removed 🏷 status: label work required Needs proper labelling before it can be worked on labels Aug 22, 2024
@TimidRobot TimidRobot moved this to Backlog in Applications Sep 10, 2024
manulthanura added a commit to manulthanura/cc-legal-tools-app that referenced this issue Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🕹 aspect: interface Concerns end-users' experience with the software ✨ goal: improvement Improvement to an existing feature help wanted Open to participation from the community 🟩 priority: low Low priority and doesn't need to be rushed 🏁 status: ready for work Ready for work
Projects
Status: Backlog
Development

No branches or pull requests

2 participants