Skip to content

Locale Contributions Wanted 🙋🙏 #171

Description

@iamkun

Release 1.6.2 was just published to the NPM with I18n support. Thanks again, everyone, for helping with this effort.

Day.js users come from all around the world, so I will happily accept translations from other languages for this project. And your work will affect thousands of daily users of Day.js.

Feel free to open a pull request if you've finished one of the three translations.

Locale (I18n)

Locale is the first translation work we need to do, and it will be released with our main code.
Locale template

Readme file

Readme file let user get a glance of our project. And tells them what we are doing.
If there is no sub pages' translation, please keep the links in readme linked to English sub pages.
Add a link to your translation in the default english readme file.
Default English Readme

Sub pages of the document

Sub pages is the detailed documents of our project.

NOTE: It is welcome to put your language in the first place in locale example in files such as I18n.md.
e.g. for Japanese docs

import 'dayjs/locale/ja'
// was import es in English ducoment
dayjs.locale('ja') // use Japanese locale globally 

Sub pages folder

Directory structure

Please place the translation files in a separate folder, and named with ISO 639-1 area code. Directory structure could be found below.

.
├── docs
│   └── es
│        ├── API-reference.md
│        ├── I18n.md
│        ├── Installation.md
│        ├── Plugin.md
│        └── README-es.md
├── src
│   └── locale
│        └── es.js
└── README.md  // default index english readme

Finally, thanks again for your contribution.

Append:
We use ISO 639-2 country code.
Check lists short codes for language here or here

Activity

  1. iamkun commented on May 19, 2018

    @iamkun
    OwnerAuthor

    ping @ohbarye, and seems you've already done it. Bravo!

  2. changed the title [-]Locale and Documentation Contributions Wanted 🙋🙏[/-] [+]Locale Contributions Wanted 🙋🙏[/+] on May 19, 2018
  3. vilanz commented on May 19, 2018

    @vilanz
    Contributor

    I'm working on the ./docs/ Brazilian Portuguese translation!

    @iamkun Is it OK to slightly modify some of the docs' wording to fit the translation? Depending on the language, some parts are pretty awkward to translate 100%.

  4. iamkun commented on May 20, 2018

    @iamkun
    OwnerAuthor

    @ludvon

    Is it OK to slightly modify some of the docs' wording

    Of course. It's up to you.

    But better keep the document's structure the same, so that I could update them easily if there is some small changes like API name or agreements change.

  5. KorbinianKuhn commented on May 22, 2018

    @KorbinianKuhn
    Contributor

    We could convert the momentjs locales to the dayjs format. I tried it automatically and it worked for most of them (there are some languages which require additional information for month name handling and the ordinal function), but we could use all others as a basis. @iamkun what do you think?

  6. iamkun commented on May 23, 2018

    @iamkun
    OwnerAuthor

    @KorbinianKuhn Thanks, this should work, but little copycat I think.

  7. aalises commented on May 23, 2018

    @aalises
    Contributor

    @iamkun for the fromNow plugin to work, I think the relativeTime variable should also be added to the locale template? Right now it is implemented on the spanish locale and the default english one, e.g

    relativeTime = {
        future: 'in %s',
        past: '%s ago',
        present: 'just now',
        s: 'a second',
        ss: '%d seconds',
        min: 'a minute',
        mins: '%d minutes',
        h: 'an hour',
        hh: '%d hours',
        d: 'a day',
        dd: '%d days',
        w: 'a week',
        ww: '%d weeks',
        m: 'a month',
        mm: '%d months',
        q: 'a quarter',
        qq: '%d quarters',
        y: 'a year',
        yy: '%d years'
      }
    

    WDYT?

  8. iamkun commented on May 23, 2018

    @iamkun
    OwnerAuthor

    I'll update this to the I18n docs after finishing the plugin.

  9. hibuno commented on May 24, 2018

    @hibuno
    Contributor

    Hi @iamkun,

    I try to add translation for Indonesian Language, but i don't know how to open pull request cz locales folder ignored by .gitignore file.

    And then how to test if my translation is working? 😄

    Thank you

  10. iamkun commented on May 24, 2018

    @iamkun
    OwnerAuthor

    @muhibbudins Hi, just open a new PR, and what's the problem now?

    If your translation could pass our auto CI test, then it should be fine.

  11. hibuno commented on May 24, 2018

    @hibuno
    Contributor

    Hi @iamkun ,

    I still can't open new PR. Because my local change is not detected 😃

    On your .gitignore file you have code like this :

    # build
    locale/
    plugin/
    dayjs.min.js
    

    So my new file on src/locale/id.js not detected on git change stage.

    screen shot 2018-05-24 at 12 12 07

    screen shot 2018-05-24 at 12 12 18

    Note : I'm already fork your repo to my account 😄
    ——
    Or maybe can you make a documentation for development?

    Thank you

  12. iamkun commented on May 24, 2018

    @iamkun
    OwnerAuthor

    @muhibbudins The .gitignore file is correct, and should working fine. However, I don't know why your git can't detect the code change.

    Maybe you could try remove the line in .gitignore file, then git status to check if it is ok, and put the removed line back.

  13. hibuno commented on May 24, 2018

    @hibuno
    Contributor

    @iamkun I am already open new PR with some change at .gitignore file. I add new condition at .gitignore file :

    # build
    locale/
    !src/locale/
    plugin/
    dayjs.min.js
    

    To ignore only locale/ folder not src/locale/.

    Thank you

    Reference #193

  14. iamkun commented on May 24, 2018

    @iamkun
    OwnerAuthor

    Thanks, I've updated the .gitignore file, and it should be OK now.

  15. added a commit that references this issue on May 29, 2018
  16. added a commit that references this issue on May 30, 2018
  17. added a commit that references this issue on May 31, 2018
  18. MartinDawson commented on Jun 7, 2018

    @MartinDawson

    At the moment dayjs only accepts language language code such as 'en'. Would be nice to accept formats like 'en-US' instead of having dayjs fail later on.

    The same as Moment.js Issue 422

  19. iamkun commented on Jun 7, 2018

    @iamkun
    OwnerAuthor

    @MartinDawson Are you mean dayjs.locale('en-US') equals to dayjs.locale('en') ?

  20. MartinDawson commented on Jun 7, 2018

    @MartinDawson

    @iamkun If I supply de-DE then it's obvious I want de locale. The library doesn't support de-DE so it makes sense to me to fall back to de.

  21. iamkun commented on Jun 7, 2018

    @iamkun
    OwnerAuthor

    @MartinDawson Well, seems not hard. All we have to do is to supply a helper function isn't it?

    dayjs.locale(helper('de-DE')) // helper will return 'de'
  22. prantlf commented on Aug 15, 2018

    @prantlf
    Contributor

    It is impossible to contribute correct Slavic localisations for the RelativeTime plugin of Day.js. It is possible for Moment.js, but for the price of overriding the whole translate method. See #302 for more information.

  23. gnurgeldiyev commented on May 3, 2020

    @gnurgeldiyev
    Contributor

    Hi @iamkun

    I just added Turkmen (tk) locale and opened new PR ✌

    PR: #893

  24. nifaliana commented on Apr 20, 2025

    @nifaliana

    Hi @iamkun

    I just added Malagasy (mg 🇲🇬) locale and opened new PR

    PR: #2863

  25. ChaiyoKung commented on Nov 4, 2025

    @ChaiyoKung

    Hi @iamkun,

    I've added the Thai readme file and opened a Pull Request (PR) for it.

    You can find the PR here: #2937

    Thank you!

  26. snehal242005 commented on Jul 30, 2026

    @snehal242005

    Hi, I'd like to add the Pashto (ps) locale

  27. FullStraing commented on Nov 20, 2026

    @FullStraing

    Added the Uyghur (ug) locale in PR #3373.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanted🚨 High Priority

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions