HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Translate in plugin Timeago
onlyonelove
New
in Localization
I use Timeago
I cant not translate word "about 1 day ago",..
please help me!
0
Comments
The easiest way to translate the strings would be to edit the following lines in
js/jquery.timeago.js
: https://github.com/kasperisager/Timeago/blob/master/js/jquery.timeago.js#L37-L49Let me know how it goes!
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
Timeago.js have translations yet: https://github.com/rmm5t/jquery-timeago/tree/master/locales
Just include your locale in your page.
@kasperisager, why not include them in the plugin? Locale can be derived automatically from vanilla configuration or from a plugin setting...
There was an error rendering this rich post.
Lol, completely forgot about the locales! I'll see what I can do, thanks for the input @lifeisfoo - it's a great idea!
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
you could
You can loop through locale definitions with a
TimeAgo.
prefix. and also have also defaults and send them to the client.grep is your friend.
Oh course @x00! I'm doing the same thing with regards to translatable JS string in my WordCount plugin which allows the plugin to be translated through normal Garden means. It's brilliant, thanks!
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
Awesomestuff, locale support is now included in version 1.3.
P.S.: Just for the record, this is the gist of what I did...
In your plugin file:
In the above,
Event
will have to be replaced with the event you'd like to utilize. I usedBase_Render_Before
in my plugin as the fuzzy timestamps are applied throughout Garden and it's applications. It would also be a good idea to prefixLocale
with the name of your plugin, which I did in Timeago:TimeagoLocale
- this simply to avoid clashes with other plugins.In your Javascript file:
And finally in
locale/da-DK.php
(just an example locale):Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub