I18n additionals (#125)

* New translation keys

* Updates in src/components

* Updates in src/providers

* remove lable in selector, not needed

---------

Co-authored-by: Lokowitz <marvinlokowitz@gmail.com>
This commit is contained in:
vlalx 2025-06-03 21:10:00 +03:00 committed by GitHub
parent dc6fafba41
commit d768bb163a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 152 additions and 51 deletions

View file

@ -1063,5 +1063,17 @@
"inviteErrorInvalidConfirmation": "Ungültige Bestätigung",
"passwordRequired": "Passwort ist erforderlich",
"allowAll": "Alle erlauben",
"permissionsAllowAll": "Alle Berechtigungen erlauben"
"permissionsAllowAll": "Alle Berechtigungen erlauben",
"githubUsernameRequired": "GitHub-Benutzername ist erforderlich",
"supportKeyRequired": "Unterstützer-Schlüssel ist erforderlich",
"passwordRequirementsChars": "Das Passwort muss mindestens 8 Zeichen lang sein",
"language": "Sprache",
"verificationCodeRequired": "Code ist erforderlich",
"userErrorNoUpdate": "Kein Benutzer zum Aktualisieren",
"siteErrorNoUpdate": "Keine Site zum Aktualisieren",
"resourceErrorNoUpdate": "Keine Ressource zum Aktualisieren",
"authErrorNoUpdate": "Keine Auth-Informationen zum Aktualisieren",
"orgErrorNoUpdate": "Keine Organisation zum Aktualisieren",
"orgErrorNoProvided": "Keine Organisation angegeben",
"apiKeysErrorNoUpdate": "Kein API-Schlüssel zum Aktualisieren"
}

View file

@ -1063,5 +1063,17 @@
"inviteErrorInvalidConfirmation": "Invalid confirmation",
"passwordRequired": "Password is required",
"allowAll": "Allow All",
"permissionsAllowAll": "Allow All Permissions"
"permissionsAllowAll": "Allow All Permissions",
"githubUsernameRequired": "GitHub username is required",
"supportKeyRequired": "Supporter key is required",
"passwordRequirementsChars": "Password must be at least 8 characters",
"language": "Language",
"verificationCodeRequired": "Code is required",
"userErrorNoUpdate": "No user to update",
"siteErrorNoUpdate": "No site to update",
"resourceErrorNoUpdate": "No resource to update",
"authErrorNoUpdate": "No auth info to update",
"orgErrorNoUpdate": "No org to update",
"orgErrorNoProvided": "No org provided",
"apiKeysErrorNoUpdate": "No API key to update"
}

View file

@ -1063,5 +1063,17 @@
"inviteErrorInvalidConfirmation": "Confirmation invalide",
"passwordRequired": "Le mot de passe est requis",
"allowAll": "Tout autoriser",
"permissionsAllowAll": "Autoriser toutes les autorisations"
"permissionsAllowAll": "Autoriser toutes les autorisations",
"githubUsernameRequired": "Le nom d'utilisateur GitHub est requis",
"supportKeyRequired": "La clé de supporter est requise",
"passwordRequirementsChars": "Le mot de passe doit comporter au moins 8 caractères",
"language": "Langue",
"verificationCodeRequired": "Le code est requis",
"userErrorNoUpdate": "Pas d'utilisateur à mettre à jour",
"siteErrorNoUpdate": "Pas de site à mettre à jour",
"resourceErrorNoUpdate": "Pas de ressource à mettre à jour",
"authErrorNoUpdate": "Pas d'informations d'authentification à mettre à jour",
"orgErrorNoUpdate": "Pas d'organisation à mettre à jour",
"orgErrorNoProvided": "Aucune organisation fournie",
"apiKeysErrorNoUpdate": "Pas de clé API à mettre à jour"
}

View file

@ -1063,5 +1063,17 @@
"inviteErrorInvalidConfirmation": "Conferma non valida",
"passwordRequired": "La password è obbligatoria",
"allowAll": "Consenti Tutto",
"permissionsAllowAll": "Consenti Tutti I Permessi"
"permissionsAllowAll": "Consenti Tutti I Permessi",
"githubUsernameRequired": "È richiesto l'username GitHub",
"supportKeyRequired": "È richiesta la chiave di supporto",
"passwordRequirementsChars": "La password deve essere di almeno 8 caratteri",
"language": "Lingua",
"verificationCodeRequired": "È richiesto un codice",
"userErrorNoUpdate": "Nessun utente da aggiornare",
"siteErrorNoUpdate": "Nessun sito da aggiornare",
"resourceErrorNoUpdate": "Nessuna risorsa da aggiornare",
"authErrorNoUpdate": "Nessuna informazione di autenticazione da aggiornare",
"orgErrorNoUpdate": "Nessuna organizzazione da aggiornare",
"orgErrorNoProvided": "Nessuna organizzazione fornita",
"apiKeysErrorNoUpdate": "Nessuna chiave API da aggiornare"
}

View file

@ -1063,5 +1063,17 @@
"inviteErrorInvalidConfirmation": "Nieprawidłowe potwierdzenie",
"passwordRequired": "Hasło jest wymagane",
"allowAll": "Zezwól wszystkim",
"permissionsAllowAll": "Zezwól na wszystkie uprawnienia"
"permissionsAllowAll": "Zezwól na wszystkie uprawnienia",
"githubUsernameRequired": "Nazwa użytkownika GitHub jest wymagana",
"supportKeyRequired": "Klucz wspierający jest wymagany",
"passwordRequirementsChars": "Hasło musi mieć co najmniej 8 znaków",
"language": "Język",
"verificationCodeRequired": "Kod jest wymagany",
"userErrorNoUpdate": "Brak użytkownika do aktualizacji",
"siteErrorNoUpdate": "Brak witryny do aktualizacji",
"resourceErrorNoUpdate": "Brak zasobu do aktualizacji",
"authErrorNoUpdate": "Brak danych uwierzytelniania do aktualizacji",
"orgErrorNoUpdate": "Brak organizacji do aktualizacji",
"orgErrorNoProvided": "Nie podano organizacji",
"apiKeysErrorNoUpdate": "Brak klucza API do aktualizacji"
}

View file

@ -1063,5 +1063,17 @@
"inviteErrorInvalidConfirmation": "Confirmação inválida",
"passwordRequired": "A senha é obrigatória",
"allowAll": "Permitir todos",
"permissionsAllowAll": "Permitir Todas as Permissões"
"permissionsAllowAll": "Permitir Todas as Permissões",
"githubUsernameRequired": "O nome de utilizador GitHub é obrigatório",
"supportKeyRequired": "A chave de apoiante é obrigatória",
"passwordRequirementsChars": "A palavra-passe deve ter pelo menos 8 caracteres",
"language": "Idioma",
"verificationCodeRequired": "O código é obrigatório",
"userErrorNoUpdate": "Não existe utilizador para atualizar",
"siteErrorNoUpdate": "Não existe site para atualizar",
"resourceErrorNoUpdate": "Não existe recurso para atualizar",
"authErrorNoUpdate": "Não existem informações de autenticação para atualizar",
"orgErrorNoUpdate": "Não existe organização para atualizar",
"orgErrorNoProvided": "Nenhuma organização fornecida",
"apiKeysErrorNoUpdate": "Não existe chave API para atualizar"
}

View file

@ -1063,5 +1063,17 @@
"inviteErrorInvalidConfirmation": "Invalid confirmation",
"passwordRequired": "Password is required",
"allowAll": "Allow All",
"permissionsAllowAll": "Allow All Permissions"
"permissionsAllowAll": "Allow All Permissions",
"githubUsernameRequired": "GitHub username is required",
"supportKeyRequired": "Supporter key is required",
"passwordRequirementsChars": "Password must be at least 8 characters",
"language": "Language",
"verificationCodeRequired": "Code is required",
"userErrorNoUpdate": "No user to update",
"siteErrorNoUpdate": "No site to update",
"resourceErrorNoUpdate": "No resource to update",
"authErrorNoUpdate": "No auth info to update",
"orgErrorNoUpdate": "No org to update",
"orgErrorNoProvided": "No org provided",
"apiKeysErrorNoUpdate": "No API key to update"
}

View file

@ -34,11 +34,6 @@ import { useUserContext } from "@app/hooks/useUserContext";
import { CheckCircle2 } from "lucide-react";
import { useTranslations } from "next-intl";
const disableSchema = z.object({
password: z.string().min(1, { message: "Password is required" }),
code: z.string().min(1, { message: "Code is required" })
});
type Disable2FaProps = {
open: boolean;
setOpen: (val: boolean) => void;
@ -53,6 +48,13 @@ export default function Disable2FaForm({ open, setOpen }: Disable2FaProps) {
const api = createApiClient(useEnvContext());
const t = useTranslations();
const disableSchema = z.object({
password: z.string().min(1, { message: t('passwordRequired') }),
code: z.string().min(1, { message: t('verificationCodeRequired') })
});
const disableForm = useForm<z.infer<typeof disableSchema>>({
resolver: zodResolver(disableSchema),
defaultValues: {
@ -61,8 +63,6 @@ export default function Disable2FaForm({ open, setOpen }: Disable2FaProps) {
}
});
const t = useTranslations();
const request2fa = async (values: z.infer<typeof disableSchema>) => {
setLoading(true);

View file

@ -1,4 +1,4 @@
import { useLocale } from 'next-intl';
import { useLocale } from "next-intl";
import LocaleSwitcherSelect from './LocaleSwitcherSelect';
export default function LocaleSwitcher() {
@ -9,35 +9,34 @@ export default function LocaleSwitcher() {
defaultValue={locale}
items={[
{
value: 'en-US',
label: 'Englisch'
value: 'en-US',
label: 'English'
},
{
value: 'fr-FR',
label: 'French'
value: 'fr-FR',
label: "Français"
},
{
value: 'de-DE',
label: 'German'
value: 'de-DE',
label: 'Deutsch'
},
{
value: 'it-IT',
label: 'Italian'
value: 'it-IT',
label: 'Italiano'
},
{
value: 'pl-PL',
label: 'Polish'
value: 'pl-PL',
label: 'Polski'
},
{
value: 'pt-PT',
label: 'Portuguese'
value: 'pt-PT',
label: 'Português'
},
{
value: 'tr-TR',
label: 'Turkish'
value: 'tr-TR',
label: 'Türkçe'
}
]}
label='Language'
/>
);
}

View file

@ -53,17 +53,6 @@ type LoginFormProps = {
idps?: LoginFormIDP[];
};
const formSchema = z.object({
email: z.string().email({ message: "Invalid email address" }),
password: z
.string()
.min(8, { message: "Password must be at least 8 characters" })
});
const mfaSchema = z.object({
code: z.string().length(6, { message: "Invalid code" })
});
export default function LoginForm({ redirect, onLogin, idps }: LoginFormProps) {
const router = useRouter();
@ -77,6 +66,19 @@ export default function LoginForm({ redirect, onLogin, idps }: LoginFormProps) {
const [mfaRequested, setMfaRequested] = useState(false);
const t = useTranslations();
const formSchema = z.object({
email: z.string().email({ message: t('emailInvalid') }),
password: z
.string()
.min(8, { message: t('passwordRequirementsChars') })
});
const mfaSchema = z.object({
code: z.string().length(6, { message: t('pincodeInvalid') })
});
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
@ -92,8 +94,6 @@ export default function LoginForm({ redirect, onLogin, idps }: LoginFormProps) {
}
});
const t = useTranslations();
async function onSubmit(values: any) {
const { email, password } = form.getValues();
const { code } = mfaForm.getValues();

View file

@ -3,6 +3,7 @@
import ApiKeyContext from "@app/contexts/apiKeyContext";
import { GetApiKeyResponse } from "@server/routers/apiKeys";
import { useState } from "react";
import { useTranslations } from "next-intl";
interface ApiKeyProviderProps {
children: React.ReactNode;
@ -12,9 +13,11 @@ interface ApiKeyProviderProps {
export function ApiKeyProvider({ children, apiKey: ak }: ApiKeyProviderProps) {
const [apiKey, setApiKey] = useState<GetApiKeyResponse>(ak);
const t = useTranslations();
const updateApiKey = (updatedApiKey: Partial<GetApiKeyResponse>) => {
if (!apiKey) {
throw new Error("No API key to update");
throw new Error(t('apiKeysErrorNoUpdate'));
}
setApiKey((prev) => {
if (!prev) {

View file

@ -3,6 +3,7 @@
import OrgContext from "@app/contexts/orgContext";
import { GetOrgResponse } from "@server/routers/org";
import { useState } from "react";
import { useTranslations } from "next-intl";
interface OrgProviderProps {
children: React.ReactNode;
@ -12,13 +13,15 @@ interface OrgProviderProps {
export function OrgProvider({ children, org: serverOrg }: OrgProviderProps) {
const [org, setOrg] = useState<GetOrgResponse | null>(serverOrg);
const t = useTranslations();
if (!org) {
throw new Error("No org provided");
throw new Error(t('orgErrorNoProvided'));
}
const updateOrg = (updatedOrg: Partial<GetOrgResponse>) => {
if (!org) {
throw new Error("No org to update");
throw new Error(t('orgErrorNoUpdate'));
}
setOrg((prev) => {

View file

@ -3,6 +3,7 @@
import OrgUserContext from "@app/contexts/orgUserContext";
import { GetOrgUserResponse } from "@server/routers/user";
import { useState } from "react";
import { useTranslations } from "next-intl";
interface OrgUserProviderProps {
children: React.ReactNode;
@ -15,9 +16,11 @@ export function OrgUserProvider({
}: OrgUserProviderProps) {
const [orgUser, setOrgUser] = useState<GetOrgUserResponse>(serverOrgUser);
const t = useTranslations();
const updateOrgUser = (updateOrgUser: Partial<GetOrgUserResponse>) => {
if (!orgUser) {
throw new Error("No org to update");
throw new Error(t('orgErrorNoUpdate'));
}
setOrgUser((prev) => {

View file

@ -4,6 +4,7 @@ import ResourceContext from "@app/contexts/resourceContext";
import { GetResourceAuthInfoResponse } from "@server/routers/resource";
import { GetResourceResponse } from "@server/routers/resource/getResource";
import { useState } from "react";
import { useTranslations } from "next-intl";
interface ResourceProviderProps {
children: React.ReactNode;
@ -22,9 +23,11 @@ export function ResourceProvider({
const [authInfo, setAuthInfo] =
useState<GetResourceAuthInfoResponse>(serverAuthInfo);
const t = useTranslations();
const updateResource = (updatedResource: Partial<GetResourceResponse>) => {
if (!resource) {
throw new Error("No resource to update");
throw new Error(t('resourceErrorNoUpdate'));
}
setResource((prev) => {
@ -43,7 +46,7 @@ export function ResourceProvider({
updatedAuthInfo: Partial<GetResourceAuthInfoResponse>
) => {
if (!authInfo) {
throw new Error("No auth info to update");
throw new Error(t('authErrorNoUpdate'));
}
setAuthInfo((prev) => {

View file

@ -3,6 +3,7 @@
import SiteContext from "@app/contexts/siteContext";
import { GetSiteResponse } from "@server/routers/site/getSite";
import { useState } from "react";
import { useTranslations } from "next-intl";
interface SiteProviderProps {
children: React.ReactNode;
@ -15,9 +16,11 @@ export function SiteProvider({
}: SiteProviderProps) {
const [site, setSite] = useState<GetSiteResponse>(serverSite);
const t = useTranslations();
const updateSite = (updatedSite: Partial<GetSiteResponse>) => {
if (!site) {
throw new Error("No site to update");
throw new Error(t('siteErrorNoUpdate'));
}
setSite((prev) => {
if (!prev) {

View file

@ -3,6 +3,7 @@
import UserContext from "@app/contexts/userContext";
import { GetUserResponse } from "@server/routers/user";
import { useState } from "react";
import { useTranslations } from "next-intl";
interface UserProviderProps {
children: React.ReactNode;
@ -12,9 +13,11 @@ interface UserProviderProps {
export function UserProvider({ children, user: u }: UserProviderProps) {
const [user, setUser] = useState<GetUserResponse>(u);
const t = useTranslations();
const updateUser = (updatedUser: Partial<GetUserResponse>) => {
if (!user) {
throw new Error("No user to update");
throw new Error(t('userErrorNoUpdate'));
}
setUser((prev) => {
if (!prev) {