Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,61 @@ module.exports = [
{
name: 'i18n-string',
path: 'dist/i18n.string.min.js',
limit: '945 b',
limit: '948 b',
},
{
name: 'typed-i18n-string',
path: 'dist/i18n.typed.string.min.js',
limit: '949 b',
limit: '953 b',
},
{
name: 'i18n-object',
path: 'dist/i18n.object.min.js',
limit: '1086 b',
limit: '1089 b',
},
{
name: 'typed-i18n-object',
path: 'dist/i18n.typed.object.min.js',
limit: '1090 b',
limit: '1095 b',
},
{
name: 'i18n-instance',
path: 'dist/i18n.instance.min.js',
limit: '1117 b',
limit: '1119 b',
},
{
name: 'all together',
path: 'dist/i18n.all.min.js',
limit: '1192 b',
limit: '1194 b',
},
{
name: 'adapter-angular',
path: 'angular/index.min.mjs',
limit: '1225 b',
limit: '1230 b',
ignore: ['angular'],
},
{
name: 'adapter-react',
path: 'react/index.min.mjs',
limit: '1560 b',
limit: '1562 b',
ignore: ['react'],
},
{
name: 'adapter-solid',
path: 'solid/index.min.mjs',
limit: '1402 b',
limit: '1403 b',
ignore: ['solid-js'],
},
{
name: 'adapter-svelte',
path: 'svelte/index.min.mjs',
limit: '1339 b',
limit: '1342 b',
ignore: ['svelte'],
},
{
name: 'adapter-vue',
path: 'vue/index.min.mjs',
limit: '1253 b',
limit: '1256 b',
ignore: ['vue'],
},
]
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

# Version 5

## 5.26.0 (2023-08-01)

Feat:
- improved plural rules support for polnish [#672](https://github.com/ivanhofer/typesafe-i18n/issues/672)

## 5.25.1 (2023-07-20)

Fix:
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,18 @@ The footprint of the `typesafe-i18n` package is smaller compared to other existi

These parts are bundled into the [core functions](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#usage). The sizes of the core functionalities are:

- [i18nString](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#i18nString): 945 bytes gzipped
- [i18nObject](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#i18nObject): 1086 bytes gzipped
- [i18n](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#i18n): 1117 bytes gzipped
- [i18nString](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#i18nString): 948 bytes gzipped
- [i18nObject](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#i18nObject): 1089 bytes gzipped
- [i18n](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/runtime#i18n): 1119 bytes gzipped

Apart from that there can be a small overhead depending on which utilities and wrappers you use.

There also exists a useful wrapper for some frameworks:
- [`typesafe-i18n` angular-service](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-angular): 1225 bytes gzipped
- [`typesafe-i18n` react-context](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-react): 1560 bytes gzipped
- [`typesafe-i18n` solid-context](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-solid): 1402 bytes gzipped
- [`typesafe-i18n` svelte-store](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-svelte): 1339 bytes gzipped
- [`typesafe-i18n` vue-plugin](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-vue): 1253 bytes gzipped
- [`typesafe-i18n` angular-service](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-angular): 1230 bytes gzipped
- [`typesafe-i18n` react-context](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-react): 1562 bytes gzipped
- [`typesafe-i18n` solid-context](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-solid): 1403 bytes gzipped
- [`typesafe-i18n` svelte-store](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-svelte): 1342 bytes gzipped
- [`typesafe-i18n` vue-plugin](https://github.com/ivanhofer/typesafe-i18n/tree/main/packages/adapter-vue): 1256 bytes gzipped


<!-- ------------------------------------------------------------------------------------------ -->
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime/src/core.mts
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ const getPlural = (pluralRules: Intl.PluralRules, { z, o, t, f, m, r }: BasicPlu
case 'two':
return t
case 'few':
return f
return f ?? r
case 'many':
return m
return m ?? r
default:
return r
}
Expand Down
12 changes: 12 additions & 0 deletions packages/runtime/src/util.object.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,4 +267,16 @@ test('switch-case with comma 2', () =>

// --------------------------------------------------------------------------------------------------------------------

const LL10 = i18nObject('pl', {
MULTIPLE_PARAMS_PLURAL: '{0} banana{{s}} and {1} apple{{s}}',
SINGULAR_PLURAL: '{{ one item | ?? items }}',
})

test('multiple params plural for language without PluralRule other', () =>
assert.is(LL10.MULTIPLE_PARAMS_PLURAL(1, 2), '1 banana and 2 apples'))
test('plural zero: one for language without PluralRule other', () => assert.is(LL10.SINGULAR_PLURAL(1), 'one item'))
test('plural zero: ?? for language without PluralRule other', () => assert.is(LL10.SINGULAR_PLURAL(5), '5 items'))

// --------------------------------------------------------------------------------------------------------------------

test.run()
2 changes: 1 addition & 1 deletion packages/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// this file gets auto-generated
export const version = '5.25.0'
export const version = '5.25.1'