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

i18n not easy to use in multilanguage project #2

Closed
jipexu opened this issue Jun 9, 2017 · 7 comments
Closed

i18n not easy to use in multilanguage project #2

jipexu opened this issue Jun 9, 2017 · 7 comments

Comments

@jipexu
Copy link
Contributor

jipexu commented Jun 9, 2017

Hi
i tried and it's work fine

   $("#myTimeline").timeline({
    i18n : {
    month: { "Jan.": "Janvier", "Fév.": "Février", "Mars": "Mars", "Avr.": "Avril", "Mai": "Mai", "Juin": "Juin", "Juillet": "Juillet", "Août.": "Août", "Sept.": "Septembre", "Oct.": "Octobre", "Nov.": "Novembre", "Déc.": "Décembre" },
    day: { "Lu": "Lundi", "Ma": "Mardi", "Me": "Mercredi", "Jeudi": "Jeudi", "Ve": "Vendredi", "Sa": "Samedi", "Di": "Dimanche" },
    ma: [ "vorm.", "nachm." ]
  },

but why not extend the object and use lang files ... with something about like this
!function(a){a.fn. timeline.i18n.de={month:[ .......
or

(function($) {
      timeline.i18n = $.extend(true,  timeline.i18n, {
        'fr_FR': { ..................

this will be more convienient

@ka215
Copy link
Owner

ka215 commented Jun 10, 2017

At the latest v1.0.3, we enhanced the function to support multiple languages. It is a system that retrives the language setting of the browser and loads the language file (JSON format). Please see the README for details.

@jipexu
Copy link
Contributor Author

jipexu commented Jun 10, 2017

OH thanks seems very cool !! I read in detail ..

@jipexu
Copy link
Contributor Author

jipexu commented Jun 10, 2017

Good good !
but why not by timeline.i18n.us_US ..... timeline.i18n.fr_FR ..... (from the lang pack?)
The problem is that the browser will always stay in the native language ... if a french want to see in japanese he must not have to change his browser parameter !?...

  • a browser lang detected without lang file will make a js error ...
    so to resume it is too much sophisticate and become not easy to use ...

@ka215
Copy link
Owner

ka215 commented Jun 12, 2017

When "timeline.i18n" is extended, the code amount of the plugin option described in the script tag becomes too huge, therefore I thought that maintainability becomes difficult.

To change the import language file, you should change the browser language setting.
However, by using the newly added "httpLanguage" option (beta), it becomes possible to use the language setting of the browser returned by the server side header.

I know that too if there is no language file 404 error will occur. I am thinking about solving this problem without increasing the inquiries to the server side.

@jipexu
Copy link
Contributor Author

jipexu commented Jun 12, 2017

ok ...
that means if i use httpLanguage:fr or httpLanguage:ja i will have the required lang file ?? regardless of the browser language setting ?

@ka215
Copy link
Owner

ka215 commented Jun 13, 2017

How to use the httpLanguage option:

  • HttpLanguage: true - Get the value of "HTTP-Accept-Language" in the response header when accessing the server of the browser and set it as the language to be used. It incorporates the JQuery-Browser-Language plugin mechanism.

  • HttpLanguage: false - Get the default language setting of the browser user agent and set it to the used language (specification implemented in v1.0.3).

The default value of this option is false.
Note that with this option true/false, care must be taken as each browser will have different values to be acquired. Since the overhead at the time of true is also large, it is basically recommended to operate with false.

@ka215
Copy link
Owner

ka215 commented Sep 27, 2017

Closed because it has already been processed this issue.

@ka215 ka215 closed this as completed Sep 27, 2017
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