Apply type migration for i18next on Account Console (#23472)

This commit is contained in:
Jon Koops 2023-09-22 15:57:19 +02:00 committed by GitHub
parent 29a515ca2b
commit fa1747cb27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 60 additions and 51 deletions

View file

@ -30,7 +30,7 @@
"directMembership": "Direct membership",
"done": "Done",
"edit": "Edit",
"editTheResource": "Edit the resource - {{0}}",
"editTheResource": "Edit the resource - {{name}}",
"email": "Email",
"error-empty": "Please specify value of '{{0}}'.",
"error-invalid-blank": "Please specify value of '{{0}}'.",
@ -79,7 +79,7 @@
"noGroups": "No groups",
"noGroupsText": "You are not joined in any group",
"notInUse": "Not in use",
"notSetUp": "{{0}} is not set up.",
"notSetUp": "{{name}} is not set up.",
"offlineAccess": "Offline access",
"otp-display-name": "Authenticator application",
"otp-help-text": "Enter a verification code from authenticator application.",
@ -87,7 +87,7 @@
"password-help-text": "Sign in by entering your password.",
"password": "My password",
"path": "Path",
"permissionRequest": "Permission requests - {{0}}",
"permissionRequest": "Permission requests - {{name}}",
"permissionRequests": "Permission requests",
"permissions": "Permissions",
"personalInfo": "Personal info",
@ -97,8 +97,8 @@
"removeAccess": "Remove access",
"removeConsentError": "Could not remove consent due to: {{error}}",
"removeConsentSuccess": "Successfully removed consent",
"removeCred": "Remove {{0}}",
"removeModalMessage": "This will remove the currently granted access permission for {{0}}. You will need to grant access again if you want to use this app.",
"removeCred": "Remove {{name}}",
"removeModalMessage": "This will remove the currently granted access permission for {{name}}. You will need to grant access again if you want to use this app.",
"requestor": "Requestor",
"required": "Required",
"resourceAlreadyShared": "Resource is already shared with this user.",
@ -111,17 +111,17 @@
"save": "Save",
"selectALocale": "Select a locale",
"selectOne": "Select an option",
"setUpNew": "Set up {{0}}",
"setUpNew": "Set up {{name}}",
"share": "Share",
"sharedWithMe": "Shared with Me",
"shareError": "Could not share the resource due to: {{error}}",
"shareSuccess": "Resource successfully shared.",
"shareTheResource": "Share the resource - {{0}}",
"shareTheResource": "Share the resource - {{name}}",
"shareUser": "Add users to share your resource with",
"shareWith": "Share with ",
"signedInDevices": "Signed in devices",
"signedInDevicesExplanation": "Sign out of any unfamiliar devices.",
"signedOutSession": "Signed out {{0}}/{{1}}",
"signedOutSession": "Signed out {{browser}}/{{os}}",
"signingIn": "Signing in",
"signingInDescription": "Configure ways to sign in.",
"signOut": "Sign out",
@ -133,7 +133,7 @@
"somethingWentWrongDescription": "Sorry, an unexpected error has occurred.",
"started": "Started",
"status": "Status",
"stopUsingCred": "Stop using {{0}}?",
"stopUsingCred": "Stop using {{name}}?",
"successRemovedMessage": "{{userLabel}} was removed.",
"systemDefined": "System defined",
"termsOfService": "Terms of service",

View file

@ -30,7 +30,7 @@
"directMembership": "Adhésion directe",
"done": "Terminer",
"edit": "Éditer",
"editTheResource": "Éditer la ressource - {{0}}",
"editTheResource": "Éditer la ressource - {{name}}",
"email": "Courriel",
"error-empty": "Veuillez spécifier la valeur de « {{0}} ».",
"error-invalid-blank": "Veuillez spécifier la valeur de « {{0}} ».",
@ -79,7 +79,7 @@
"noGroups": "Aucun groupe",
"noGroupsText": "Vous n'appartenez à aucun groupe",
"notInUse": "Inutilisé",
"notSetUp": "{{0}} n'est pas configuré.",
"notSetUp": "{{name}} n'est pas configuré.",
"offlineAccess": "Accès hors-ligne",
"otp-display-name": "Application d'authentification",
"otp-help-text": "Entrez un code de vérification depuis votre application d'authentification.",
@ -87,7 +87,7 @@
"password-help-text": "S'authentifier en entrant son mot de passe.",
"password": "Mon mot de passe",
"path": "Chemin",
"permissionRequest": "Demandes d'autorisation - {{0}}",
"permissionRequest": "Demandes d'autorisation - {{name}}",
"permissionRequests": "Demandes d'autorisation",
"permissions": "Autorisations",
"personalInfo": "Informations personelles",
@ -97,8 +97,8 @@
"removeAccess": "Supprimer l'accès",
"removeConsentError": "Impossible de supprimer le consentement en raison de : {{error}}",
"removeConsentSuccess": "Consentement supprimé",
"removeCred": "Supprimer {{0}}",
"removeModalMessage": "Cela supprimera l'autorisation d'accès actuellement accordée pour {{0}}. Vous devrez de nouveau obtenir les accès si vous souhaitez utiliser cette application.",
"removeCred": "Supprimer {{name}}",
"removeModalMessage": "Cela supprimera l'autorisation d'accès actuellement accordée pour {{name}}. Vous devrez de nouveau obtenir les accès si vous souhaitez utiliser cette application.",
"requestor": "Demandeur",
"required": "Requis",
"resourceAlreadyShared": "La ressource est déjà partagée avec cet utilisateur.",
@ -111,17 +111,17 @@
"save": "Sauvegarder",
"selectALocale": "Sélectionner une langue",
"selectOne": "Sélectionner une option",
"setUpNew": "Configurer {{0}}",
"setUpNew": "Configurer {{name}}",
"share": "Partager",
"sharedWithMe": "Partagé avec moi",
"shareError": "Impossible de partager la ressource à cause de : {{error}}",
"shareSuccess": "La ressource a bien été partagée.",
"shareTheResource": "Partager la ressource - {{0}}",
"shareTheResource": "Partager la ressource - {{name}}",
"shareUser": "Ajouter les utilisateurs avec qui partager la ressource",
"shareWith": "Partager avec ",
"signedInDevices": "Appareils connectés",
"signedInDevicesExplanation": "Déconnectez-vous de tout appareil non familier.",
"signedOutSession": "Déconnecté {{0}}/{{1}}",
"signedOutSession": "Déconnecté {{browser}}/{{os}}",
"signingIn": "Connexion",
"signingInDescription": "Configurez les façons de vous authentifier.",
"signOut": "Déconnexion",
@ -133,7 +133,7 @@
"somethingWentWrongDescription": "Désolé, une erreur inattendue s'est produite.",
"started": "Première connexion",
"status": "Statut",
"stopUsingCred": "Arrêter d'utiliser {{0}} ?",
"stopUsingCred": "Arrêter d'utiliser {{name}} ?",
"successRemovedMessage": "{{userLabel}} a été supprimé.",
"systemDefined": "Défini par le système",
"termsOfService": "Conditions d'utilisation",

View file

@ -30,7 +30,7 @@
"directMembership": "Direct lidmaatschap",
"done": "Klaar",
"edit": "Bewerken",
"editTheResource": "Bewerk de resource - {{0}}",
"editTheResource": "Bewerk de resource - {{name}}",
"email": "E-mail",
"error-empty": "Geef een waarde op voor '{{0}}'",
"error-invalid-blank": "Geef een waarde op voor '{{0}}'",
@ -79,7 +79,7 @@
"noGroups": "Geen groepen",
"noGroupsText": "U bent bij geen enkele groep aangesloten",
"notInUse": "Niet in gebruik",
"notSetUp": "{{0}} is niet ingesteld.",
"notSetUp": "{{name}} is niet ingesteld.",
"offlineAccess": "Offline toegang",
"otp-display-name": "Authenticator-applicatie",
"otp-help-text": "Voer een verificatiecode in van de authenticator-applicatie.",
@ -87,7 +87,7 @@
"password-help-text": "Meld u aan door uw wachtwoord in te voeren.",
"password": "Mijn wachtwoord",
"path": "Pad",
"permissionRequest": "Machtigingsverzoek - {{0}}",
"permissionRequest": "Machtigingsverzoek - {{name}}",
"permissionRequests": "Machtigingsverzoeken",
"permissions": "Machtigingen",
"personalInfo": "Persoonlijke informatie",
@ -97,8 +97,8 @@
"removeAccess": "Toegang verwijderen",
"removeConsentError": "Kan toestemming niet verwijderen vanwege: {{error}}",
"removeConsentSuccess": "Toestemming verwijderd",
"removeCred": "Verwijder {{0}}",
"removeModalMessage": "Hiermee wordt de momenteel verleende toegangsrechten voor {{0}} verwijderd. U moet opnieuw toegang verlenen als u deze app wilt gebruiken.",
"removeCred": "Verwijder {{name}}",
"removeModalMessage": "Hiermee wordt de momenteel verleende toegangsrechten voor {{name}} verwijderd. U moet opnieuw toegang verlenen als u deze app wilt gebruiken.",
"requestor": "Aanvrager",
"required": "Vereist",
"resourceAlreadyShared": "Resource is al gedeeld met deze gebruiker.",
@ -111,17 +111,17 @@
"save": "Opslaan",
"selectALocale": "Selecteer een taal",
"selectOne": "Kies een optie",
"setUpNew": "Stel {{0}} in",
"setUpNew": "Stel {{name}} in",
"share": "Delen",
"sharedWithMe": "Gedeeld met mij",
"shareError": "Kan de resource niet delen vanwege: {{error}}",
"shareSuccess": "Resource succesvol gedeeld.",
"shareTheResource": "Deel de resource - {{0}}",
"shareTheResource": "Deel de resource - {{name}}",
"shareUser": "Voeg gebruikers toe om uw resource mee te delen",
"shareWith": "Delen met ",
"signedInDevices": "Ingelogde apparaten",
"signedInDevicesExplanation": "Meld u af bij onbekende apparaten.",
"signedOutSession": "Afgemeld op {{0}}/{{1}}",
"signedOutSession": "Afgemeld op {{browser}}/{{os}}",
"signingIn": "Aanmelden",
"signingInDescription": "Configureer manieren om aan te melden.",
"signOut": "Afmelden",
@ -133,7 +133,7 @@
"somethingWentWrongDescription": "Sorry, er is een onverwachte fout opgetreden.",
"started": "Gestart",
"status": "Status",
"stopUsingCred": "Stoppen met het gebruik van {{0}}?",
"stopUsingCred": "Stoppen met het gebruik van {{name}}?",
"successRemovedMessage": "{{userLabel}} is verwijderd.",
"systemDefined": "Systeem gedefinieerd",
"termsOfService": "Servicevoorwaarden",

View file

@ -29,7 +29,7 @@
"directMembership": "Прямое членство",
"done": "Выполнено",
"edit": "Редактировать",
"editTheResource": "Редактировать ресурс - {{0}}",
"editTheResource": "Редактировать ресурс - {{name}}",
"email": "E-mail",
"error-empty": "Пожалуйста, укажите значение '{{0}}'.",
"error-invalid-blank": "Пожалуйста, укажите значение '{{0}}'.",
@ -79,7 +79,7 @@
"noGroups": "Групп нет",
"noGroupsText": "Вы не состоите ни в одной группе",
"notInUse": "Не используется",
"notSetUp": "{{0}} не настроено.",
"notSetUp": "{{name}} не настроено.",
"offlineAccess": "Offline доступ",
"otp-display-name": "приложение аутентификатор",
"otp-help-text": "Ввод проверочного кода из приложения аутентификатора.",
@ -87,7 +87,7 @@
"password-help-text": "Вход с использованием ввода пароля.",
"password": "Пароль",
"path": "Путь",
"permissionRequest": "Запросы на разрешение - {{0}}",
"permissionRequest": "Запросы на разрешение - {{name}}",
"permissionRequests": "Запросы на разрешение",
"permissions": "Разрешения",
"personalInfo": "Личная информация",
@ -97,8 +97,8 @@
"removeAccess": "Удалить доступ",
"removeConsentError": "Не удалось удалить согласия из-за: {{error}}",
"removeConsentSuccess": "Согласие успешно удалено",
"removeCred": "Удалить {{0}}",
"removeModalMessage": "Это приведет к удалению предоставленного в данный момент разрешения доступа для {{0}}. Вам нужно будет снова предоставить доступ, если вы хотите использовать это приложение.",
"removeCred": "Удалить {{name}}",
"removeModalMessage": "Это приведет к удалению предоставленного в данный момент разрешения доступа для {{name}}. Вам нужно будет снова предоставить доступ, если вы хотите использовать это приложение.",
"requestor": "Запрашивающий",
"required": "Обязательный",
"resourceAlreadyShared": "Ресурс уже является общим для этого пользователя.",
@ -111,17 +111,17 @@
"save": "Сохранить",
"selectALocale": "Выбрать язык",
"selectOne": "Выберите опцию",
"setUpNew": "Настроить {{0}}",
"setUpNew": "Настроить {{name}}",
"share": "Делиться",
"sharedWithMe": "Поделился со мной",
"shareError": "Не удалось предоставить общий доступ к ресурсу из-за: {{error}}",
"shareSuccess": "Ресурсу успешно предоставлен общий доступ.",
"shareTheResource": "Поделитесь ресурсом - {{0}}",
"shareTheResource": "Поделитесь ресурсом - {{name}}",
"shareUser": "Добавляйте пользователей, с которыми вы можете поделиться своим ресурсом",
"shareWith": "Делитесь с ",
"signedInDevices": "Выполнен вход на устройствах",
"signedInDevicesExplanation": "Выполните выход с незнакомых устройств.",
"signedOutSession": "Сессия завершена {{0}}/{{1}}",
"signedOutSession": "Сессия завершена {{browser}}/{{os}}",
"signingIn": "Вход",
"signingInDescription": "Настройте способы входа в систему.",
"signOut": "Выход",
@ -133,7 +133,7 @@
"somethingWentWrongDescription": "Извините, произошла непредвиденная ошибка.",
"started": "Начата",
"status": "Статус",
"stopUsingCred": "Остановить использование {{0}}?",
"stopUsingCred": "Остановить использование {{name}}?",
"successRemovedMessage": "{{userLabel}} был удалён.",
"systemDefined": "Определенная система",
"termsOfService": "Условия обслуживания",

View file

@ -72,7 +72,9 @@ const DeviceActivity = () => {
) => {
try {
await deleteSession(session.id);
addAlert(t("signedOutSession", [session.browser, device.os]));
addAlert(
t("signedOutSession", { browser: session.browser, os: device.os }),
);
refresh();
} catch (error) {
addError(t("errorSignOutMessage", { error }).toString());

View file

@ -139,9 +139,9 @@ const SigningIn = () => {
action: container.createAction,
})
}
title={t("setUpNew", [
t(container.displayName as TFuncKey),
])}
title={t("setUpNew", {
name: t(container.displayName as TFuncKey),
})}
/>
</div>
</SplitItem>
@ -151,7 +151,9 @@ const SigningIn = () => {
<DataList aria-label="credential list" className="pf-u-mb-xl">
{container.userCredentialMetadatas.length === 0 && (
<EmptyRow
message={t("notSetUp", [t(container.displayName as TFuncKey)])}
message={t("notSetUp", {
name: t(container.displayName as TFuncKey),
})}
/>
)}
@ -171,9 +173,9 @@ const SigningIn = () => {
{container.removeable ? (
<ContinueCancelModal
buttonTitle={t("delete")}
modalTitle={t("removeCred", [
label(meta.credential),
])}
modalTitle={t("removeCred", {
name: label(meta.credential),
})}
continueLabel={t("confirm")}
cancelLabel={t("cancel")}
buttonVariant="danger"
@ -196,7 +198,9 @@ const SigningIn = () => {
}
}}
>
{t("stopUsingCred", [label(meta.credential)])}
{t("stopUsingCred", {
name: label(meta.credential),
})}
</ContinueCancelModal>
) : (
<Button

View file

@ -250,7 +250,7 @@ const Applications = () => {
buttonVariant="secondary"
onContinue={() => removeConsent(application.clientId)}
>
{t("removeModalMessage", [application.clientId])}
{t("removeModalMessage", { name: application.clientId })}
</ContinueCancelModal>
</GridItem>
<GridItem>

View file

@ -1,4 +1,4 @@
import { TFunction, createInstance } from "i18next";
import { createInstance } from "i18next";
import HttpBackend from "i18next-http-backend";
import { initReactI18next } from "react-i18next";
@ -8,7 +8,10 @@ import { joinPath } from "./utils/joinPath";
const DEFAULT_LOCALE = "en";
const DEFAULT_NAMESPACE = "translation";
export type TFuncKey = Parameters<TFunction>[1];
// This type is aliased to any, so that we can find all the places where we use it.
// In the future all casts to this type should be removed from the code, so
// that we can have a proper type-safe translation function.
export type TFuncKey = any;
export const i18n = createInstance({
defaultNS: DEFAULT_NAMESPACE,

View file

@ -51,7 +51,7 @@ export const EditTheResource = ({
return (
<Modal
title={t("editTheResource", [resource.name])}
title={t("editTheResource", { name: resource.name })}
variant="medium"
isOpen
onClose={onClose}

View file

@ -70,7 +70,7 @@ export const PermissionRequest = ({
<Badge>{resource.shareRequests?.length}</Badge>
</Button>
<Modal
title={t("permissionRequest", [resource.name])}
title={t("permissionRequest", { name: resource.name })}
variant={ModalVariant.large}
isOpen={open}
onClose={toggle}

View file

@ -113,7 +113,7 @@ export const ShareTheResource = ({
return (
<Modal
title={t("shareTheResource", [resource.name])}
title={t("shareTheResource", { name: resource.name })}
variant="medium"
isOpen={open}
onClose={onClose}