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

Multiple locale support #280

Open
mahemoff opened this issue Jun 3, 2016 · 0 comments
Open

Multiple locale support #280

mahemoff opened this issue Jun 3, 2016 · 0 comments

Comments

@mahemoff
Copy link
Contributor

mahemoff commented Jun 3, 2016

Hi, I've made some updates to support multiple locales simultaneously. It uses a data attribute to decide, e.g. can use <time data-locale='en_abbrev' ...> and define a setting like en_abbrevStrings.

Would it be useful?

Gist

U.setupTimeAgo = ->
  $.extend jQuery.timeago.settings.strings,
    strings: '1 minute'
    hour: '1 hour'
    day: '1 day'
    hours: "%d hours"
    month: '1 month'
    year: '1 year'
    inPast: 'seconds'
    seconds: 'seconds'
    minute: '1 minute'
    week: 'week'
    weeks: 'weeks'
    months: 'months'
    months: '%d months'
    years: '%d years'
  jQuery.timeago.settings.en_abbrevStrings = $.extend {}, jQuery.timeago.settings.strings
  $.extend jQuery.timeago.settings.en_abbrevStrings,
    suffixAgo: ''
    hour: '1h'
    day: '1d'
    hours: "%d h"
    month: '1M'
    year: '1y'
    inPast: 'pre'
    seconds: 's'
    minute: '1m'
    days: '%dd'
    week: '1w'
    weeks: '%dw'
    month: '1M'
    months: '%dM'
    years: '%dy'
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

1 participant