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

we will need to pull out ui text out of components into i18n files #22

Closed
balmas opened this issue Dec 18, 2017 · 5 comments
Closed

we will need to pull out ui text out of components into i18n files #22

balmas opened this issue Dec 18, 2017 · 5 comments
Assignees

Comments

@balmas
Copy link
Member

balmas commented Dec 18, 2017

we will need to pull out ui text out of components into i18n files

not an urgent priority but maybe something to do when we move components out of the extension into their own library

@kirlat
Copy link
Member

kirlat commented Jan 6, 2018

Since we are probably interested in localizing messages that are shown via UI only, and all of the UI is implemented with Vue, I think it will be best to use a Vue localization plugin for that. The main benefit would be reactivity: UI will be updated automatically after a locale is changed.

Browser extension localization API (https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Internationalization) would be of not much help for us, I believe. First of all, it is tied to language preferences set in a browser configuration. Thus, there is no way to change a UI language without changing it in browser settings. I don't think changing it there is a viable in many cases:

  • User is not using his/her own computer (i.e. Internet Cafe).
  • User browser language preferences are not configured correctly and user does not know/care how to do that.
  • For whatever reason user wants to use a UI language that is different from the one set in browser options.
    Second, it does not have much features. For example, plurals are not supported AFAIK.

There are several Vue.js i18n plugins to choose from (I omitted the ones that are not actively developed or requires special Vue modules such as Vuex):

What features would we need for i18n? In what way our i18n/l10n requirements may extend in the future?

@balmas
Copy link
Member Author

balmas commented Jan 8, 2018

this is great info. let's discuss.

@balmas
Copy link
Member Author

balmas commented Jan 8, 2018

Ok some basic requirements:

  1. Separation of text and translations from code
  2. Works with Vue components but also could be fairly easily ported to other frameworks if need be
  3. Need to be able to localize messages and data as well as the UI elements. If we can use the same solution for all of these great, but if not, then we should use what is best for each.
  4. dynamic locale switching
  5. support for standard formats and language codes

I think the trickiest part of this might be knowing where the separation between data models and ui elements lies and finding a solution that makes sense across all of these.

For example, we have data coming back from the tufts-adapter that we map to Features which for which we use Constant strings to limit and normalize results. Those strings are currently in English, because our parsers output them in English. We probably would continue to normalize to English even if we have other parsers which use other languages, but then we may need to translate those strings for display, as well as extend them with abbreviations, extend them with captions, etc. (see my hack for gender abbreviations at https://github.com/alpheios-project/data-models/blob/master/src/i18n.js and https://github.com/alpheios-project/data-models/blob/master/src/feature.js#L80-L85 )

It would be nice to have a standard approach that worked across the entire ecosystem, but it might also be acceptable to have different approach for each distinct need (As long as those were used consistently).

@balmas balmas mentioned this issue Jan 15, 2018
16 tasks
@balmas
Copy link
Member Author

balmas commented Jan 15, 2018

@kirlat I like the approach taken in commits 99be95f and 6795062 . I think we should go with it for now, and we can begin to move messages over to it after the alpha release.

@balmas balmas assigned balmas and unassigned kirlat Feb 15, 2018
balmas pushed a commit that referenced this issue Feb 15, 2018
moved text out of vue components into l10n messages file
balmas pushed a commit that referenced this issue Feb 15, 2018
@balmas
Copy link
Member Author

balmas commented Feb 15, 2018

this is done for the ui text and messages. Will need to decide upon and implement a solution for the data and data providers still.

@balmas balmas closed this as completed Feb 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants