Git Product home page Git Product logo

js-cldr-timezones's Introduction

Cached translations of timezones for js

Install

gem install js-cldr-timezones

Usage

This project supports over 573 languages. We provide a file with a hash that has the translations. In the html header translations you should add:

<%= javascript_include_tag "js_cldr/#{locale}_cldr_timezones" %>

locale is a bcp-47 language tag. However the dash is substituted by an underscore to make it. For example:

<%= javascript_include_tag "js_cldr/es_cldr_timezones" %>

<%= javascript_include_tag "js_cldr/ja_cldr_timezones" %>

<%= javascript_include_tag "js_cldr/es_MX_cldr_timezones" %>

This provides access to a hash that has the name in the following format:

"#{locale}_cldr_timezones_hash"

The hash contains a meaninful subset of 124 timezones. It has the timezone indentifier as the key and the translation as the value.

Examples:

es_cldr_timezones_hash["Europe/Moscow"] # "(GMT+04:00) Moscú"

ja_cldr_timezones_hash["America/Cordoba"] # "(GMT-09:00)モスクワ"

There is also support for fallback.

es_MX_cldr_timezones_hash["Europe/Moscow"] # "(GMT+04:00) Moscú"

Development

Translations are already included in the project and you don't need to generate them. However if you want to fork this project and generate your own translations you should simply run:

rake generate_timezones

This project uses ruby-cldr-timezones to generate the javascript for each language.

TODO

  • Support for option :all which will provide the complete set of timezones that are supported by ruby-cldr-timezones

Author

Ana Martinez
[email protected]
License: MIT

Build Status Code Climate

js-cldr-timezones's People

Contributors

grosser avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.