Skip to content

Commit

Permalink
docs: Use placeholder in selectOrdinal's examples and test cases (#1222)
Browse files Browse the repository at this point in the history
  • Loading branch information
orangain authored Apr 24, 2022
1 parent 2232738 commit d272bc2
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
14 changes: 7 additions & 7 deletions docs/ref/macro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,9 @@ cardinal plural forms it uses ordinal forms:
import { selectOrdinal } from "@lingui/macro"
const message = selectOrdinal(count, {
one: "1st",
two: "2nd",
few: "3rd",
one: "#st",
two: "#nd",
few: "#rd",
other: "#th",
})
Expand All @@ -467,7 +467,7 @@ cardinal plural forms it uses ordinal forms:
import { i18n } from "@lingui/core"
const message =
/*i18n*/
i18n._('{count, selectOrdinal, one {1st} two {2nd} few {3rd} other {#th}}', {
i18n._('{count, selectOrdinal, one {#st} two {#nd} few {#rd} other {#th}}', {
count
})
Expand Down Expand Up @@ -802,9 +802,9 @@ format:
// count == 4 -> 4th
<SelectOrdinal
value={count}
one="1st"
two="2nd"
few="3rd"
one="#st"
two="#nd"
few="#rd"
other="#th"
/>
Expand Down
6 changes: 3 additions & 3 deletions docs/ref/message-format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ Overview
+------------------+------------------------------------------------------------------+
| .. icu:: ordinal | .. code-block:: none |
| | |
| Ordinals | {count, selectOrdinal, one {1st message} |
| | two {2nd message} |
| | few {3rd message} |
| Ordinals | {count, selectOrdinal, one {#st message} |
| | two {#nd message} |
| | few {#rd message} |
| | other {#th message}} |
+------------------+------------------------------------------------------------------+
2 changes: 1 addition & 1 deletion packages/cli/src/api/formats/po-gettext.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ msgstr[2] "# dní"
describe("when using 'selectOrdinal' format", () => {
const catalog = {
select_ordinal_message: {
message: `{count, selectOrdinal, one {1st} two {2nd} few {3rd} other {#th}}`,
message: `{count, selectOrdinal, one {#st} two {#nd} few {#rd} other {#th}}`,
translation: "",
},
}
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/api/pseudoLocalize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ describe("PseudoLocalization", () => {
it("SelectOrdinal", () => {
expect(
pseudoLocalize(
"{count, selectordinal, offset:1 one {1st} two {2nd} few {3rd} =4 {4th} many {testMany} other {#th}}"
"{count, selectordinal, offset:1 one {#st} two {#nd} few {#rd} =4 {4th} many {testMany} other {#th}}"
)
).toEqual(
"{count, selectordinal, offset:1 one {1śţ} two {2ńď} few {3ŕď} =4 {4ţĥ} many {ţēśţMàńŷ} other {#ţĥ}}"
"{count, selectordinal, offset:1 one {#śţ} two {#ńď} few {#ŕď} =4 {4ţĥ} many {ţēśţMàńŷ} other {#ţĥ}}"
)
})

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/dev/compile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("compile", function () {

it("should compile selectordinal", function () {
const cache = prepare(
"{value, selectordinal, one {1st Book} two {2nd Book}}"
"{value, selectordinal, one {#st Book} two {#nd Book}}"
)
expect(cache({ value: 1 })).toEqual("1st Book")
expect(cache({ value: 2 })).toEqual("2nd Book")
Expand Down
6 changes: 3 additions & 3 deletions packages/macro/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ declare module "@lingui/macro" {
* ```
* import { selectOrdinal } from "@lingui/macro";
* const message = selectOrdinal(count, {
* one: "1st",
* two: "2nd",
* few: "3rd",
* one: "#st",
* two: "#nd",
* few: "#rd",
* other: "#th",
* });
* ```
Expand Down
6 changes: 3 additions & 3 deletions packages/macro/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ export function plural(value: number | string, options: ChoiceOptions): string
* ```
* import { selectOrdinal } from "@lingui/macro";
* const message = selectOrdinal(count, {
* one: "1st",
* two: "2nd",
* few: "3rd",
* one: "#st",
* two: "#nd",
* few: "#rd",
* other: "#th",
* });
* ```
Expand Down
6 changes: 3 additions & 3 deletions packages/macro/test/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ select(value, {

/** Select Ordinal test */
selectOrdinal(value, {
one: "1st",
two: "2nd",
few: "3rd",
one: "#st",
two: "#nd",
few: "#rd",
other: "#th",
})

0 comments on commit d272bc2

Please sign in to comment.