From 00d69bc8e5e76289b981271d09ef118a66a8da5c Mon Sep 17 00:00:00 2001
From: Tobias Skarhed <1438972+tskarhed@users.noreply.github.com>
Date: Wed, 7 Feb 2024 16:37:42 +0100
Subject: [PATCH] i18n: Phrases for login page (#81478)
* i18n markup for login components
* Add serviceName to translation
* Fix typo
* Reset from main
* Extract
* Fix extract
---
.../app/core/components/Login/LoginForm.tsx | 19 +++++++++----
.../app/core/components/Login/LoginPage.tsx | 4 +--
.../components/Login/LoginServiceButtons.tsx | 28 +++++++++++--------
.../app/core/components/Login/UserSignup.tsx | 7 +++--
public/locales/en-US/grafana.json | 16 +++++++++++
public/locales/pseudo-LOCALE/grafana.json | 16 +++++++++++
6 files changed, 69 insertions(+), 21 deletions(-)
diff --git a/public/app/core/components/Login/LoginForm.tsx b/public/app/core/components/Login/LoginForm.tsx
index 7eea1bb5dc6..cfc706ad62c 100644
--- a/public/app/core/components/Login/LoginForm.tsx
+++ b/public/app/core/components/Login/LoginForm.tsx
@@ -5,6 +5,7 @@ import { useForm } from 'react-hook-form';
import { GrafanaTheme2 } from '@grafana/data';
import { selectors } from '@grafana/e2e-selectors';
import { Button, Input, Field, useStyles2 } from '@grafana/ui';
+import { t } from 'app/core/internationalization';
import { PasswordField } from '../PasswordField/PasswordField';
@@ -31,9 +32,13 @@ export const LoginForm = ({ children, onSubmit, isLoggingIn, passwordHint, login
return (
diff --git a/public/app/core/components/Login/LoginPage.tsx b/public/app/core/components/Login/LoginPage.tsx
index 07c1435a613..bdefbfd5696 100644
--- a/public/app/core/components/Login/LoginPage.tsx
+++ b/public/app/core/components/Login/LoginPage.tsx
@@ -7,7 +7,7 @@ import { GrafanaTheme2 } from '@grafana/data';
import { config } from '@grafana/runtime';
import { Alert, HorizontalGroup, LinkButton, useStyles2 } from '@grafana/ui';
import { Branding } from 'app/core/components/Branding/Branding';
-import { t } from 'app/core/internationalization';
+import { t, Trans } from 'app/core/internationalization';
import { ChangePassword } from '../ForgottenPassword/ChangePassword';
@@ -54,7 +54,7 @@ export const LoginPage = () => {
fill="text"
href={`${config.appSubUrl}/user/password/send-reset-email`}
>
- Forgot your password?
+
Forgot your password?
)}
diff --git a/public/app/core/components/Login/LoginServiceButtons.tsx b/public/app/core/components/Login/LoginServiceButtons.tsx
index eefd6e61669..084852c3480 100644
--- a/public/app/core/components/Login/LoginServiceButtons.tsx
+++ b/public/app/core/components/Login/LoginServiceButtons.tsx
@@ -5,6 +5,7 @@ import React from 'react';
import { GrafanaTheme2, DEFAULT_SAML_NAME } from '@grafana/data';
import { Icon, IconName, LinkButton, useStyles2, useTheme2, VerticalGroup } from '@grafana/ui';
import config from 'app/core/config';
+import { Trans } from 'app/core/internationalization';
export interface LoginService {
bgColor: string;
@@ -150,18 +151,21 @@ export const LoginServiceButtons = () => {
return (
- {Object.entries(enabledServices).map(([key, service]) => (
-
-
- Sign in with {service.name}
-
- ))}
+ {Object.entries(enabledServices).map(([key, service]) => {
+ const serviceName = service.name;
+ return (
+
+
+ Sign in with {{ serviceName }}
+
+ );
+ })}
);
}
diff --git a/public/app/core/components/Login/UserSignup.tsx b/public/app/core/components/Login/UserSignup.tsx
index 56559860549..7b039d59113 100644
--- a/public/app/core/components/Login/UserSignup.tsx
+++ b/public/app/core/components/Login/UserSignup.tsx
@@ -3,6 +3,7 @@ import React from 'react';
import { LinkButton, VerticalGroup } from '@grafana/ui';
import { getConfig } from 'app/core/config';
+import { Trans } from 'app/core/internationalization';
export const UserSignup = () => {
const href = getConfig().verifyEmailEnabled ? `${getConfig().appSubUrl}/verify` : `${getConfig().appSubUrl}/signup`;
@@ -10,7 +11,9 @@ export const UserSignup = () => {
return (
- New to Grafana?
+
+ New to Grafana?
+
{
variant="secondary"
fill="outline"
>
- Sign up
+ Sign up
);
diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json
index ecc2e4d6c98..4a5f64e0b05 100644
--- a/public/locales/en-US/grafana.json
+++ b/public/locales/en-US/grafana.json
@@ -673,6 +673,22 @@
"invalid-user-or-password": "Invalid username or password",
"title": "Login failed",
"unknown": "Unknown error occurred"
+ },
+ "forgot-password": "Forgot your password?",
+ "form": {
+ "password-label": "Password",
+ "password-required": "Password is required",
+ "submit-label": "Log in",
+ "submit-loading-label": "Logging in...",
+ "username-label": "Email or username",
+ "username-required": "Email or username is required"
+ },
+ "services": {
+ "sing-in-with-prefix": "Sign in with {{serviceName}}"
+ },
+ "signup": {
+ "button-label": "Sign up",
+ "new-to-question": "New to Grafana?"
}
},
"nav": {
diff --git a/public/locales/pseudo-LOCALE/grafana.json b/public/locales/pseudo-LOCALE/grafana.json
index 9574a0f87fa..2e45e4f0383 100644
--- a/public/locales/pseudo-LOCALE/grafana.json
+++ b/public/locales/pseudo-LOCALE/grafana.json
@@ -673,6 +673,22 @@
"invalid-user-or-password": "Ĩʼnväľįđ ūşęřʼnämę őř päşşŵőřđ",
"title": "Ŀőģįʼn ƒäįľęđ",
"unknown": "Ůʼnĸʼnőŵʼn ęřřőř őččūřřęđ"
+ },
+ "forgot-password": "Főřģőŧ yőūř päşşŵőřđ?",
+ "form": {
+ "password-label": "Päşşŵőřđ",
+ "password-required": "Päşşŵőřđ įş řęqūįřęđ",
+ "submit-label": "Ŀőģ įʼn",
+ "submit-loading-label": "Ŀőģģįʼnģ įʼn...",
+ "username-label": "Ēmäįľ őř ūşęřʼnämę",
+ "username-required": "Ēmäįľ őř ūşęřʼnämę įş řęqūįřęđ"
+ },
+ "services": {
+ "sing-in-with-prefix": "Ŝįģʼn įʼn ŵįŧĥ {{serviceName}}"
+ },
+ "signup": {
+ "button-label": "Ŝįģʼn ūp",
+ "new-to-question": "Ńęŵ ŧő Ğřäƒäʼnä?"
}
},
"nav": {