- [Fix] Handle null and undefined gracefully in extend and unset (#161)
- [Fix] French starts plural at 2 (#154)
- [Refactor] Replace
for-each
withobject.entries
andarray.prototype.foreach
(#127) - [Performance] Add plural type name memoization (#158)
- [Deps] Update
string.prototype.trim
(#127) - [Dev Deps] update
chai
,safe-publish-latest
,eslint
,eslint-plugin-import
(#127)
- [New] add ability to configure pluralization rules (#138)
- [Fix] fix plurals for Russian with n > 100 (#119)
- [Performance] Remove unnecessary dollar signs replacement (#132)
- [Docs] fix typo in the Czech example (#123)
- [Deps] update
warning
- [Dev Deps] update
chai
,eslint
,eslint-config-airbnb-base
,eslint-plugin-import
,safe-publish-latest
,uglify-js
- [Tests] on
node
v12
,v11
,v10
- [New] add ability to change interpolation regex by specifying prefix and suffix (#106, #64)
- [New] support for Serbian (Latin & Cyrillic), Bosnian (Latin & Cyrillic), Czech (#113)
- [Fix] Moved lt to it's own group (#101)
- [Fix] Moved tr from chinese to german group (#100)
- [Fix] Move persian(fa) language to german group of pluralization (#86)
- [Fix] Remove long-since-updated build files
- [Fix] fix russian pluralization; add tests (#115)
- [Fix] croatian is not russian (#114)
- [Clarity] add more specific locales, even though language codes will match them (#115)
- [Docs] document constructor options (#84)
- [Docs] document all instance and static methods (#83)
- [Docs] fix spelling of "delimiter" (#91)
- [Docs]
onMissingKey
can (rather, should) return a value (#95) - [Docs] fix instructions to only recommend use with npm (#96)
- [Docs] Added documentation for method has (#104)
- [Docs] add example for languages with multiple plurals (#108)
- [Docs] remove outdated sentence (#112, #110)
- [Deps] update
for-each
,has
,warning
- [Dev Deps] update
chai
,eslint
,eslint-config-airbnb-base
,eslint-plugin-import
,mocha
; removeshould
- [Tests] up to
node
v10
; usenvm install-latest-npm
to ensure new npm doesn’t break old node; improve matrix
- [Fix] revert unintentional breaking change of missing substitutions being untouched
- [Dev Deps] update
eslint
,eslint-config-airbnb-base
,mocha
,should
; addsafe-publish-latest
- [Fix] restore behavior of explicit null/undefined not touching the substitution
- [New] add
onMissingKey
constructor option - this can call.transformPhrase
, or returnfalse
, orundefined
, or throw - whatever you like (#34, #77) - [Dev Deps] update
eslint
- [Fix] revert unintentional breaking change of missing substitutions being untouched
- [Fix] restore behavior of explicit null/undefined not touching the substitution
- [Fix] ensure that missing or null substitutions don’t crash (#79)
- [New] Merge choosePluralForm & interpolate into one exported function:
transformPhrase
(#75) - [New] Allow locales to have regions (#70)
- [New] Support Arabic pluralization (#71)
- [New] Added Lithuanian locale to russian group of pluralization (#68)
- [Deps] update
object.assign
,warning
- [Dev Deps] pin
uglify-js
because it does not follow semver - [Dev Deps] update
eslint-config-airbnb-base
,eslint
,eslint-plugin-import
,mocha
,should
,uglify-js
- [Performance] instead of creating a new regex for each token, use the function form of
replace
(#19) - [Refactor] use
warning
package for warnings - [Robustness] Use
has
package to properly check “has own property” - [Robustness] use
string.prototype.trim
rather than a homegrown trim polyfill - [Tests] only test on latest
node
v7
,v6
,v5
,v4
, andiojs
; improve test matrix - [Tests] add linting
- [Breaking] Remove non-node support + use object.assign/for-each.
- [New] Add Slovak language to the Czech pluralization group
- [Fix] fix
warn
messages innode
, wherethis
is not the global object - [Tests] up to
node
v5.10
,v4.4
- [Tests] decaffeinate tests
- [Tests] up to
node
v5.1
- [Tests] fix npm upgrades on older nodes
- [Dev Deps] update
uglify-js
,docco
,should
,mocha
, and fix test pollution
- [Fix] Ensure that dollar signs are properly escaped in substitutions (#43)
- [Docs] use SPDX-compliant license string (#44)
- [New] Add
unset
method (#43) - [Tests] test on travis-ci
- Add
.has(key)
method (thanks @scarfacedeb). - Add UMD wrapper for AMD support (thanks @TomOne).
- Allow blank translations.
- Added support for
warn
option for custom error handler (thanks @terinjokes). - Added some more plural forms (thanks @jgill333).
- Added support for nested phrase objects to
extend()
and in thephrases
option in the constructor.
- Breaking change: Removed
pluralize()
method; instead, just use thet()
method, passing in asmart_count
option. - Breaking change: Removed the ability to use
Array
,Backbone.Collection
, etc. instances for thesmart_count
option; instead, must pass aNumber
. - Allow passing
Number
as second argument tot()
, which gets converted to the options object{smart_count: <my number>}
.
- Added
allowMissing
option to let the phrase key be the default translation (thanks @ziad-saab).
- Breaking change: Moved from Singleton pattern to class-based. Now you create an instance of the
Polyglot
class rather than using class methods directly on it. The reason is to allow maintaining multiple sets of phrases, which is something we ran into at Airbnb with a highly-concurrent Express app. - Breaking change: Removed the built-in Handlebars helpers, because Handlebars is a singleton, and it's messy to create a single helper function that can be bound to different Polyglot instances. Instead, it's super easy to create your own, based on your requirements.