Lang.js is a simple and lightweight library to handle in the browser:

The API is close to Laravel, allowing to use Laravel language files in both Blade and JavaScript.

While doing researches, I also learned various interest things about pluralization in languages.



Languages can have from 1 to 6 plural forms. There’s a Unicode standard ( on the naming of these rules in order to pick the right plural form:
- zero
- one
- two
- few
- many
- other

Russian and Arabic: use all of them.
English and French: 2 of them.

Aside from Lang.js, you can also use the `Intl.PluralRules` API (not on IE):

It helps detecting which pluralization rule you should apply for a given language and quantity.



See also Lingui (, another lib.

If you want to compile Laravel lang files to JSON that will be loaded by your front-end, you can also use `laravel-js-localization`(

I don’t use it. I’ll elaborate on how I use Lang.js with Laravel once my solution will be battle-tested in a wider range of situations.

Sign in to participate in the conversation

Ceci est l'instance du site NintendojoFR. Elle est réservée aux membres de la rédaction et à nos chers lecteurs qui souhaitent avoir un compte.