-
Notifications
You must be signed in to change notification settings - Fork 368
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
# is being replaced by%__lingui_octothorpe__% outside plural and selectordinal #1927
Comments
I'm guessing it's
|
I narrowed it, the bug seems to occur only when the translation starts with EDIT: found more test cases that fail Here's a test case for it("._ should not bug when with #", () => {
const messages = {
Bad: "#{standing} in leaderboard",
BadToo: "leaderboard standing is {standing}#",
BadTooToo: "your id is {name}#{tag}",
Good: "# standing in leaderboard",
GoodToo: "standing is #{standing} in leaderboard",
GoodTooToo: "leaderboard standing is #{standing}",
}
const i18n = setupI18n({
locale: "en",
messages: { en: messages },
})
expect(i18n._({ id: "Bad", values: { standing: 7 } })).toEqual(
"#7 in leaderboard"
)
expect(i18n._({ id: "BadToo", values: { standing: 7 } })).toEqual(
"leaderboard standing is 7#"
)
expect(
i18n._({ id: "BadTooToo", values: { name: "hey", tag: "you" } })
).toEqual("your id is hey#you")
expect(i18n._({ id: "Good", values: { standing: 7 } })).toEqual(
"# standing in leaderboard"
)
expect(i18n._({ id: "GoodToo", values: { standing: 7 } })).toEqual(
"standing is #7 in leaderboard"
)
expect(i18n._({ id: "GoodTooToo", values: { standing: 7 } })).toEqual(
"leaderboard standing is #7"
)
}) |
it seems there is an issue in message format parser, it shouldn't treat '#' symbol as octothorpe outside |
Describe the bug
Given a regular messages that has
#
in it , when trying to display the message it is replaced with%__lingui_octothorpe__%
EDIT: it seems to happen only if the translated message starts with
#
To Reproduce
Resulting in po:
Expected behavior
#7 in leaderboard
Actual result
%__lingui_octothorpe__%7 in leaderboard
Additional context
Add any other context about the problem here.
4.7.1
7.12.3
(i think, CRA)@lingui/swc-plugin
babel-macro-plugin
The text was updated successfully, but these errors were encountered: