Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefixed ordinal keys #1945

Merged
merged 2 commits into from
Jun 9, 2023
Merged

prefixed ordinal keys #1945

merged 2 commits into from
Jun 9, 2023

Conversation

adrai
Copy link
Member

@adrai adrai commented Apr 12, 2023

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
Copy link

stale bot commented Apr 25, 2023

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
Copy link

stale bot commented May 4, 2023

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
Copy link

stale bot commented May 19, 2023

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
@coveralls
Copy link

coveralls commented Jun 8, 2023

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
3 of 5 checks passed
@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.

None yet

3 participants