Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

I18n reload (It's serious this time :) )#632

Merged
mmckegg merged 14 commits into
ssbc:masterfrom
gmarcos87:i18n-reload
Sep 30, 2017
Merged

I18n reload (It's serious this time :) )#632
mmckegg merged 14 commits into
ssbc:masterfrom
gmarcos87:i18n-reload

Conversation

@gmarcos87

@gmarcos87 gmarcos87 commented Sep 29, 2017

Copy link
Copy Markdown
Contributor

This pull request tries to unify all the porpose that is around i18n and patchwork.
Basically it proposes:

  • I18n via depject
  • i18n-js as a translation engine
  • Human-time wrapping
  • Language selection in the setup screen
  • If there is no language configuration, try autodetection
  • Configuration stored via settings.sync.set
  • Auto-loading of all languages
  • Rerender all screens when detecting language change

@gmarcos87 gmarcos87 mentioned this pull request Sep 29, 2017
3 tasks

@mmckegg mmckegg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking pretty good @gmarcos87. Just a couple of requested changes (as below).

This does have me wondering (since this is the first time I've worked with internationalization), what is the plan for keeping the translations up to date when new features/strings are added?

Other question: what about languages where word order is different? Do we need to think about placeholders and formatting in the i18n strings?

Comment thread lib/window.js
var config = ${JSON.stringify(config)}
var data = ${JSON.stringify(opts.data)}
var title = ${JSON.stringify(opts.title || 'Patchwork')}
var title = ${JSON.stringify(opts.title || "Patchwork" )}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason for switching to use double quotes on some strings?

Patchwork code mostly conforms to JavaScript Standard Style (and I personally use this as a linter when working on it), and this only allows double quotes (") when you want to escape single ones.

'ev-change': (ev) => api.settings.sync.set({
patchwork: {theme: ev.target.value}
h('h2', i18n('Theme')),
computed(currentTheme, currentTheme => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you rebase/merge with the latest master, you'll see that the theme picker has been replaced with a select dropdown box instead of the toggle buttons. I suggest you use that for the language picker too!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, I see that this has already merged in the change. But it has overridden it with the old code putting the original theme picker back in.

Can you update this to use the new code from df3a0af ?

Comment thread plugs/intl/sync/i18n.js

function time (date){
return date
.replace(/from now/, i18n('form now'))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just noticed a typo on this string: should be "from now" not "form now"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also has matching typos in the string tables.

@mmckegg mmckegg merged commit db20e2e into ssbc:master Sep 30, 2017
mmckegg added a commit that referenced this pull request Sep 30, 2017
@mmckegg

mmckegg commented Sep 30, 2017

Copy link
Copy Markdown
Contributor

Okay, I've gone ahead and fixed the things I mentioned above and merged!

Also I think I'm starting to understand how the i18n module works 😃

Looks like there is a lot we can do later to improve the quality of the translations including substitutions (word ordering) and pluralisation.

@gmarcos87

Copy link
Copy Markdown
Contributor Author

I also never did an i18n implementation on such large projects. I encountered several challenges, many of them unresolved.
In Spanish, as in many other languages, words are assigned an implicit gender. Usually the generalizations are made in masculine form, but seen from a more critical point of view this reinforces the preexisting inequalities between genres. This forces to determine the gender of the recipient, or impose the gender definition of the recipient. I do not know if you understand what I mean, but it is a problematic situation that is usually ignored, or accepted as a final determination.

I also noticed two more technical elements to solve, the order of the variables in the sentences and how to incorporate future translations that come from external modules.

For the order of the variables it may be better to opt for another translation engine, i18nline has support for pluralization and multiple variables.

I do not know if I could incorporate external translations, my knowledge of depject does not go so far. It would be interesting to find a solution, even giving the user the ability to change the translation for what seems most convenient and share it on your network.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants