For now all we have for JS is Drupal.t() and Drupal.formatPlural() which is nice but pretty basic.

We need to look at what we can do on the JS side to help with localizing JS strings and how that can fit with JS libraries that already have internationalization tools/processes. It might turn out we don't want to do much more than what we're currently doing, I don't know.

First we need to list all the problems/limitation of the current state of things then brainstorm ideas about how to address this.

Comments

Gábor Hojtsy’s picture

Drupal.t() and Drupal.formatPlural() although not very well known, are fantastic in that they map to their PHP equivalents basically 1-1 (except JS syntax obviously). I think there are certain values in there, that would be bad to loose unless we have very good reasons to do something else in JS. (Also, we put in tons of work to level the JS functionality with the Drupal PHP API side, adding context in D8 to JS strings too, so we invested quite a bit there already :).

nod_’s picture

Yes I agree, I'm not trying to undermine the work already done on the JS side of things.

I'm concerned when I see issues like this one (it's verbose and doesn't minify very well/at all) #507502: (needs documentation) Provide Locale support for jQuery UI. I'd like to fine a more elegant solution for it and maybe make it possible to integrate a bit more gracefully with the translations provided by the third party library or help third party script integrate with drupal translations. I'm not sure it has to be done but it needs to be discussed at least.

Gábor Hojtsy’s picture

Title: Internationalization of JS » Integrate JS internationalization with third party libraries

Yes, those sound like great goals. Retiling for that to reflect that we are not redoing the existing functionality.

nod_’s picture

Yep much better, thanks. That's what I had in mind, was putting the wrong words over it.

Gábor Hojtsy’s picture

Issue tags: +language-ui

Fix tag.

nod_’s picture

Version: 8.0.x-dev » 8.1.x-dev
Issue summary: View changes

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.