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

Set locale from within app: support multi language app #503

Closed
fredhersch opened this issue May 27, 2021 · 6 comments
Closed

Set locale from within app: support multi language app #503

fredhersch opened this issue May 27, 2021 · 6 comments
Assignees
Labels
type:enhancement New feature or request

Comments

@fredhersch
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Currently can't set the locale from within a client app. Need to use the system settings. This makes it difficult to support multi-languages within an application

Describe the solution you'd like

  • Ability to set the language from within the client app itself
  • This would then render any questionnaires with the available locale extension
  • Any app controls would also be translated if these are provided in the strings.xml

Describe alternatives you've considered
#465

Additional context
For showing this working, let's add a language options to the reference application. This can be accessed by hitting the settings icon. Will update reference app mocks

https://screenshot.googleplex.com/9aTFbEpCzNgDV2i.png

Would you like to work on the issue?
Happy to provide additional input

@ndegwamartin
Copy link
Collaborator

@fredhersch could I get access to the mock up linked above so that I can implement the language switcher?

@fredhersch
Copy link
Collaborator Author

fredhersch commented Jun 16, 2021

@ndegwamartin Martin, what would be better is if you could add a drawer to the demo app and have the language option in there. Similar to the COVAX demo app that was shared yesterday. Let me know if this doesn't make sense.

Can you make the list of languages a config option too

@ndegwamartin
Copy link
Collaborator

@ndegwamartin Martin, what would be better is if you could add a drawer to the demo app and have the language option in there. Similar to the COVAX demo app that was shared yesterday. Let me know if this doesn't make sense.

Can you make the list of languages a config option too

@fredhersch yeah I think we can go with the drawer approach.

For the configuration of the list of languages, what did you have in mind?

@fredhersch
Copy link
Collaborator Author

fredhersch commented Jun 16, 2021

@ndegwamartin re: configuration - I was just thinking it would be based on an input file (like the strings.xml) with options for the languages being supported

@ndegwamartin
Copy link
Collaborator

@fredhersch got you. We can have an array with language codes (Case insensitive) e.g.

<string-array name="languages">
   <item>en</item>
   <item>sw</item>
   <item>fr</item>
</string-array>

This will work for any valid language tags that conform to the IETF BCP 47 standard (same as HL7 FHIR) e.g. en-US .
The UI can then automatically display the full name e.g. English (United States)

@jingtang10
Copy link
Collaborator

Discussed with @fredhersch @f-odhiambo and @ndegwamartin. Multiple language translation is a feature the data capture library already supports: if the questionnaire resource has translation information, namely questions and text fields have the FHIR translation extension, they will be displayed if the language matches the system language. For example if a questionnaire is in English and French, if your phone system language is english, we'll display english, if your phone system language is french, we'll display french.

However, language switching functionality within the application (i.e. providing a UI to do it) is a different thing. As @ndegwamartin has demonstrated here, the implementation is not without complexity (also see https://proandroiddev.com/change-language-programmatically-at-runtime-on-android-5e6bc15c758 and other blogposts). What the implementation does is essentially changing the underlying context and setting the locale, so that the data capture library renders the questionnaire in a different language context.

This does not demonstrate any new functionality of the library. It's demonstrating how we can change language in an android app, which is very useful, but not what the data capture library does. As a result, I feel this feature should live in the appication (or fhir core), but not in the demo app for the data capture library.

This PR is still valuable and anyone wishing to implement something like this can use thsi code, but it's not something we'll be maintaining in the data capture gallary app.

I hope this sounds reasonable to all, and as a result I'll close this issue - but please do feel free to reopen the discussion. Thanks!

Data capture library automation moved this from To do to Done Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants