Skip to content

prefixed ordinal keys#1945

Merged
adrai merged 2 commits into
masterfrom
prefixed_ordinal
Jun 9, 2023
Merged

prefixed ordinal keys#1945
adrai merged 2 commits into
masterfrom
prefixed_ordinal

Conversation

@adrai

@adrai adrai commented Apr 12, 2023

Copy link
Copy Markdown
Member

instead of:

// i.e. english
{
  "key_one": "{{count}}st place", // 1st, 21st, 31st
  "key_two": "{{count}}nd place", // 2nd, 22nd, 32nd
  "key_few": "{{count}}rd place", // 3rd, 23rd, 33rd
  "key_other": "{{count}}th place" // 4th, 5th, 24th, 11th
}
// ...
i18next.t('key', { count: 1, ordinal: true }); // -> "1st place"
i18next.t('key', { count: 21, ordinal: true }); // -> "21st place"
i18next.t('key', { count: 2, ordinal: true }); // -> "2nd place"
i18next.t('key', { count: 11, ordinal: true }); // -> "11th place"
i18next.t('key', { count: 32, ordinal: true }); // -> "32nd place"

new:

// i.e. english
{
  "key_ordinal_one": "{{count}}st place", // 1st, 21st, 31st
  "key_ordinal_two": "{{count}}nd place", // 2nd, 22nd, 32nd
  "key_ordinal_few": "{{count}}rd place", // 3rd, 23rd, 33rd
  "key_ordinal_other": "{{count}}th place" // 4th, 5th, 24th, 11th
}
// ...
i18next.t('key', { count: 1, ordinal: true }); // -> "1st place"
i18next.t('key', { count: 21, ordinal: true }); // -> "21st place"
i18next.t('key', { count: 2, ordinal: true }); // -> "2nd place"
i18next.t('key', { count: 11, ordinal: true }); // -> "11th place"
i18next.t('key', { count: 32, ordinal: true }); // -> "32nd place"

but there's also a fallback to the keys without _ordinal prefix

TODO: update the docs: https://www.i18next.com/translation-function/plurals#ordinal-plurals

@adrai adrai requested a review from jamuhl April 12, 2023 09:11
@stale

stale Bot commented Apr 25, 2023

Copy link
Copy Markdown

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the stale label Apr 25, 2023
@adrai adrai removed the stale label Apr 26, 2023
@stale

stale Bot commented May 4, 2023

Copy link
Copy Markdown

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the stale label May 4, 2023
@adrai adrai removed the stale label May 4, 2023
@stale

stale Bot commented May 19, 2023

Copy link
Copy Markdown

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the stale label May 19, 2023
@adrai adrai removed the stale label May 19, 2023
@adrai adrai force-pushed the prefixed_ordinal branch from 919d2d5 to 35dd628 Compare June 8, 2023 09:07
@coveralls

coveralls commented Jun 8, 2023

Copy link
Copy Markdown

Coverage Status

coverage: 92.112% (-0.03%) from 92.14% when pulling ada2013 on prefixed_ordinal into 3c5308e on master.

@adrai adrai mentioned this pull request Jun 8, 2023
7 tasks
@adrai adrai merged commit 3048948 into master Jun 9, 2023
@adrai adrai deleted the prefixed_ordinal branch June 9, 2023 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants