Comments (37)
sounds good idea for its usability reason
from chap-links-library.
It would also be great to be able to customize the timezone in which dates are displayed.
from chap-links-library.
I just did that for timeline and the modification is quite simple. But it would be nice if the library was i18n native. Here is my approach
https://gist.github.com/3745603
Works like a charm.
Best Regards,
José Renato.
from chap-links-library.
Thanks for your input Jose, this was indeed my idea too.
from chap-links-library.
Hi Jose, thank you for your idea,
I tried to do localization as shown on https://github.com/tigist/timeline .
However when I run the application I get error options is undefined. The
timeline is not created.
I looked at your code this morning and I did as you specified it.
--I created two new settings parameters in timiline.options.
--I passed options as a parameter in getLabelMinor and getLabelmajor
--I used options.i18n[options.lang].... to get the selected language
But I am getting the same error 'options is undefined' to get the timeline.
If you have any comment or update.
Kind regards,
Tigist Seyum
On Wed, Sep 19, 2012 at 7:56 AM, Jos de Jong [email protected]:
Thanks for your input Jose, this was indeed my idea too.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-8680074.
from chap-links-library.
Tigist, when I add your code to the timeline, this.options is available without any problem. So I guess you need to do some debugging in your complete timeline-code and/or the way you call the method setLanguage.
from chap-links-library.
Hi mates,
Here is the entire code: https://gist.github.com/3749287
Enjoy,
José Renato.
from chap-links-library.
Jos, you are doing a nice work with all those libraries. Thanks for you too.
from chap-links-library.
Hi Jose and jos,
Thank you for your feedback I have implemented the timeline localization. https://github.com/tigist/timeline
Tigist,
from chap-links-library.
Nice tigist, but how can we provide a new unsupported language in that way? Let's say I need french, Is it possible to create some sort of addLanguage method to switch then?
from chap-links-library.
Jos, you are doing a nice work with all those libraries. Thanks for you too.
Thanks. With contributions and feedback from you and others it can only get better and better :)
from chap-links-library.
btw. iktuz, your idea on putting the translations in the options itself is quite clever - that way people can indeed add their own language when needed. I hadn't thought of that.
Maybe we need to extend the method setOptions then so It will merge nested objects in options (like i18n) instead of overwriting them.
what is your idea Tigist?
from chap-links-library.
Hi Jose,
To add functionality for unsupported language, simply we can extend the
setLanguage itself by creating extra generic variable I think. Also, as you
said it is possible to create addLanguage method that can add the new
language to the setLanguage.
Regards,
On Wed, Sep 19, 2012 at 5:46 PM, iktuz [email protected] wrote:
Nice tigist, but how can we provide a new unsupported language in that
way? Let's say I need french, Is it possible to create some sort of
addLanguage method to switch then?—
Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-8695426.
from chap-links-library.
Hi Jos,
It is good idea. But, I think to allow users to add their own language we
need to create a method that can extend the i18n framework besides the
setOptions.
I didn't get what you mean by overwriting them
On Thu, Sep 20, 2012 at 9:10 AM, Jos de Jong [email protected]:
btw. iktuz, your idea on putting the translations in the options itself is
quite clever - that way people can indeed add their own language when
needed. I hadn't thought of that.Maybe we need to extend the method setOptions then so It will merge nested
objects in options (like i18n) instead of overwriting them.what is your idea Tigist?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-8718544.
from chap-links-library.
With Jose's solution you can do something like this:
var data = [...];
var options = {
...,
'language': 'myCustomLang',
'i18n': {
'myCustomLang' : {
'MONTHS_SHORT' : new Array("bla", "bla", "bla", ...),
'MONTHS' : new Array("bla", "bla", "bla", ...),
'DAYS' : new Array("bla", "bla", "bla", ...)
}
}
};
timeline.draw(data, options);
which is quite elegant and easy to understand I think. Of course it can also be solved with a method addLanguage or something like that.
What would happen in my example above is that the new options.i18n will overwrite the default options.i18n, so when you would change the language dynamically with setLanguage, you will have a problem. So to prevent that, the custom options.i18n should be merged with the default options.i18n instead of overwriting it (see the implementation in setOptions).
from chap-links-library.
Are there any progress on implementing this?
from chap-links-library.
There is a ready made solution created by Jose waiting to be cut&pasted into the Timeline. Tigist has been working on it but that was never finished. I think it will be done for the next version of the Timeline.
from chap-links-library.
Hi guys,
Just to clarify. Does Timeline in the current (snapshot) version already support I18N stuff or not?
from chap-links-library.
No. There is ready-made a solution available but it's not yet implemented.
from chap-links-library.
2.4.1-i18n version here: bjarkebech@128b631
from chap-links-library.
Cool! Will it integrated into 2.4.2 or what is the planning here? I need i18n stuff at the end of April :-). Thanks for your effort guys!
from chap-links-library.
I think we can release a next version (2.4.2) in two or three weeks, that should be fine with your planing. Lets await whether we can add some more bugfixes/improvements within that time.
from chap-links-library.
Timeline will rock if you could add i18n stuff to the 2.4.2!
Thanks for your effort.
from chap-links-library.
well, I didn't do it - @bjarkebech and @iktuz implemented i18n for the Timeline. I can release a next version though :)
from chap-links-library.
What languages are supported currently? I could add German, Russian and Spain. Are there any instructions how to add new languages (wiki?).
from chap-links-library.
@bjarkebech added English and Danish. We should add more built-in languages, which is easy: add them to the options.i18n object in the constructor of the Timeline (line 211) and do another pull request :).
from chap-links-library.
Sounds easy :-). I will do this.
from chap-links-library.
By the way, there are other places which are still not localized, like messages "New", "Move left", "Zoom in", ... I will fix them too. Furthermore, we need locales like "en" and not only "en_US" or "en_UK". I would set something like
options.i18n["en"] = options.i18n["en_US"];
from chap-links-library.
And in the future we should think about to separate the i18n file, so that everybody can add their messages and include them separate in a page. In the PrimeFaces Extensions project we did this approach as follows https://github.com/primefaces-extensions/primefaces-extensions.github.com/wiki/PrimeFaces-Extensions-Locales
Just FYI.
from chap-links-library.
Great! thanks.
You could indeed add aliases like "en" for "en_US", though the latter is the official i18n namings so maybe it is wise to just adhere these? If you need these aliases, you can of course add them dynamically when loading a Timeline, by simply adding them to the initial options that you feed to the Timeline.
from chap-links-library.
Adding dynamically outside of timeline.js script would be an option. Thanks. We need definitely "en" too because if you e.g. call toString() on Locale.ENGLISH or new Locale("en", null, null) in Java, you will get "en" string and that's the problem. I mean the browser can send "en" as well as "en_US" in request header as preferred locale.
from chap-links-library.
Just released Timeline 2.4.2 including the localization implemented by @ova2.
from chap-links-library.
Sweet! However, the first day of week is Monday and not Sunday. I know americans sometimes treats Sunday as the first day of week, but I'd guess most languages follows the ISO standard (http://en.wikipedia.org/wiki/ISO_8601#Week_dates).
from chap-links-library.
We can change it, no problem. I didn't notice this fact. Now I see this. But one question - is it really important for the Timeline? Will we get problem with this days order?
from chap-links-library.
Now when I think of it, I can't see any problem in it... As long as there is no concept of day-of-week, we should be fine. Good thing you thought one step further than me :-)
from chap-links-library.
@mbgjohansson well, JavaScript's Date.getDay() is defined as 0 = Sunday, 1 = Monday, ..., 6 = Saturday, and we just have to match our weekday-arrays with this behaviour.
from chap-links-library.
Yes, that's right. So, no problem with that.
from chap-links-library.
Related Issues (20)
- chap links timeline customisation HOT 3
- Start and group after double click HOT 7
- Timeline - Wrong item top position with empty group HOT 3
- Network - How can I fire an event on node/link selection HOT 1
- Timeline - Set custom time with click HOT 2
- Can't scroll vertically when on mobile HOT 1
- (timeline) fix top and group axis left to scroll down with touch - Question HOT 12
- zoomin and zoomout feature not working in chaps link library timeline slider HOT 1
- On executing draw/redraw the slider not rendering after first time calling the draw method of chaps link library timeline. HOT 1
- 1 month offset in timeline HOT 2
- Destroy method for timeline
- Drag and Drop from external events
- Time limit
- Input textbox not working.
- Timeline "isSelected" and "unselectItem" don't work with clusters
- Can't load graphs while running GWT projects, but it runs with JS version
- graph3d.js enhancements HOT 1
- Stacking not always working
- B.C. Dates possible?
- Keep -dump output pristine
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chap-links-library.