feat(SW-706): add Lokalise tooling and codemod

This commit is contained in:
Michael Zetterberg
2025-03-12 07:02:49 +01:00
parent 1c5b116ed8
commit e22fc1f3c8
26 changed files with 1478 additions and 130 deletions

View File

@@ -0,0 +1,11 @@
/* eslint-disable formatjs/enforce-description */
/* eslint-disable formatjs/enforce-default-message */
/* eslint-disable formatjs/no-id */
import { getIntl } from "@/i18n"
export default async function ServerComponentWithIntl() {
const intl = await getIntl()
return <h1>{intl.formatMessage({ id: "some value goes here" })}</h1>
}

View File

@@ -0,0 +1,21 @@
/* eslint-disable formatjs/enforce-description */
/* eslint-disable formatjs/enforce-default-message */
/* eslint-disable formatjs/no-id */
import { getIntl } from "@/i18n"
export default async function ServerComponentWithTernaryInside() {
const intl = await getIntl()
const someId = 'someId'
const data = {
type: 'something'
}
return (
<h1>
{intl.formatMessage({ id: someId })}
{intl.formatMessage({ id: data.type })}
</h1>
)
}

View File

@@ -0,0 +1,17 @@
/* eslint-disable formatjs/enforce-description */
/* eslint-disable formatjs/enforce-default-message */
/* eslint-disable formatjs/no-id */
import { getIntl } from "@/i18n"
export default async function ServerComponentWithTernaryInside() {
const intl = await getIntl()
return (
<h1>
{intl.formatMessage(
true ? { id: "Some true string" } : { id: "Some false string" }
)}
</h1>
)
}

View File

@@ -0,0 +1,16 @@
/* eslint-disable formatjs/enforce-description */
/* eslint-disable formatjs/enforce-default-message */
/* eslint-disable formatjs/no-id */
import { getIntl } from "@/i18n"
export default async function ServerComponentWithTernaryInside() {
const intl = await getIntl()
const variable = "some value"
return (
<h1>
{intl.formatMessage({ id: `String with ${variable}` })}
</h1>
)
}