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

chore: remove the deprecated 'isTranslated' property #1907

Merged
merged 1 commit into from
Apr 5, 2024
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
19 changes: 0 additions & 19 deletions packages/react/src/Trans.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ describe("Trans component", () => {
message: "Default",
translation: "Translation",
children: "Translation",
isTranslated: true,
})
})

Expand Down Expand Up @@ -369,7 +368,6 @@ describe("Trans component", () => {
expect(element).toEqual(`<div id="Headline">value</div>`)
expect(propsSpy).toHaveBeenCalledWith({
id: "Headline",
isTranslated: false,
message: undefined,
translation: "Headline",
children: "Headline",
Expand All @@ -388,8 +386,6 @@ describe("Trans component", () => {
{props.translation && (
<div data-testid="translation">{props.translation}</div>
)}

<div data-testid="is-translated">{String(props.isTranslated)}</div>
</>
)

Expand All @@ -405,21 +401,6 @@ describe("Trans component", () => {
expect(markup.queryByTestId("translation")?.innerHTML).toEqual(
"Translation"
)
expect(markup.queryByTestId("is-translated")?.innerHTML).toEqual("true")
})

it("should pass isTranslated: false if no translation", () => {
const markup = render(
<I18nProvider i18n={i18n} defaultComponent={DefaultComponent}>
<Trans id="NO_ID" message="Some message" />
</I18nProvider>
)

expect(markup.queryByTestId("id")?.innerHTML).toEqual("NO_ID")
expect(markup.queryByTestId("translation")?.innerHTML).toEqual(
"Some message"
)
expect(markup.queryByTestId("is-translated")?.innerHTML).toEqual("false")
})

describe("TransNoContext", () => {
Expand Down
6 changes: 0 additions & 6 deletions packages/react/src/TransNoContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ export type TransRenderProps = {
translation: React.ReactNode
children: React.ReactNode
message?: string | null
/**
* @deprecated isTranslated prop is undocumented and buggy. It'll be removed in v5 release.
* */
isTranslated: boolean
}

export type TransRenderCallbackOrComponent =
Expand Down Expand Up @@ -110,8 +106,6 @@ export function TransNoContext(
id,
message,
translation,
// TODO vonovak - remove isTranslated prop in v5 release
isTranslated: id !== translation && message !== translation,
children: translation, // for type-compatibility with `component` prop
}

Expand Down
Loading