SuffolkLITLab / docassemble-ALToolbox

Collection of small utility functions, classes, and web components for Docassemble interviews
https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/framework/altoolbox
MIT License
14 stars 2 forks source link

Create a standard language selection component #22

Closed nonprofittechy closed 2 years ago

nonprofittechy commented 3 years ago

It would be useful to have a standard component that allows someone to specify the language that they speak.

Here is one example that displays every world language, in English:

  - What language do you speak best? Type or select one.: parent.language
    datatype: combobox
    code: |
      [lang.name for lang in pycountry.languages]     

This page is slow to load and includes a lot of obsolete languages and synthetic languages like Klingon and Esperanto.

Here is another:

    - ${student.name.first}'s language: student.language
      input type: radio
      choices:
        - English
        - Spanish
        - Other

This one obviously is very easy to use, but it does not list many languages. You could add more and fit about 10 or so on a screen. The "Other" box gives a place to write other languages. If the person writes in their native language though, it may not help with obtaining court translation services.

There is a tradeoff between being very comprehensive and letting someone quickly find the language that they speak. There is a very long tail of less commonly spoken languages that someone will need to specify. A good input also needs to account for the fact that sometimes people will be getting assistance from an advocate who does not speak their language well, and sometimes they will be using the tool on their own. That means it may sometimes be helpful to display the language in the native language, and sometimes in English.

We may want to re-use the question to allow someone to change the interface language. So it should provide ISO two letter codes. That means a function to translate from the ISO code into the language, that is itself internationalized.

There may be a Google API we can use.

This issue could be a good place to collect alternatives.

BryceStevenWilley commented 2 years ago

This is in the Assembly Line question library now, as it's attached to the user object: https://github.com/SuffolkLITLab/docassemble-AssemblyLine/blob/7c371c531b5defd92332dddd00931fcf5073df70/docassemble/AssemblyLine/data/questions/ql_baseline.yml#L1774-L1781