From 36983d8d3b504870dc3c2fc48b9d7c2d60dd6f5c Mon Sep 17 00:00:00 2001 From: Josh Hunt Date: Mon, 17 Jan 2022 16:58:49 +0000 Subject: [PATCH] Chore: Mark up User Profile page for translation (#43874) * Mark up User profile page for translation * Extract new messages * updated selectors * update selectors * wip TestProvider * update tests * fix field labels * extract new messages * don't store date objects in redux state * don't store date objects in redux state --- .linguirc | 7 +- .../src/selectors/components.ts | 6 + .../SharedPreferences/SharedPreferences.tsx | 54 ++++++-- public/app/features/admin/UserSessions.tsx | 11 +- public/app/features/admin/state/actions.ts | 6 +- .../features/profile/UserOrganizations.tsx | 22 ++- .../features/profile/UserProfileEditForm.tsx | 41 ++++-- .../profile/UserProfileEditPage.test.tsx | 23 ++-- public/app/features/profile/UserSessions.tsx | 35 +++-- .../features/profile/state/reducers.test.ts | 2 +- public/app/features/profile/state/reducers.ts | 4 +- public/locales/en/messages.po | 114 ++++++++++++++- public/locales/es/messages.po | 114 ++++++++++++++- public/locales/fr/messages.po | 114 ++++++++++++++- public/locales/pseudo-LOCALE/messages.po | 130 ++++++++++++++++++ public/test/helpers/TestProvider.tsx | 8 ++ public/test/mocks/linguiMacro.tsx | 4 + 17 files changed, 629 insertions(+), 66 deletions(-) create mode 100644 public/locales/pseudo-LOCALE/messages.po create mode 100644 public/test/helpers/TestProvider.tsx diff --git a/.linguirc b/.linguirc index 383d2faee3b..3a6a7c4b82f 100644 --- a/.linguirc +++ b/.linguirc @@ -2,7 +2,8 @@ "locales": [ "en", "fr", - "es" + "es", + "pseudo-LOCALE" ], "catalogs": [ { @@ -11,14 +12,18 @@ "public/app" ], "exclude": [ + "**/*.d.ts", + "**/*.test.ts", "**/node_modules/**", "public/app/plugins" ] } ], "fallbackLocales": { + "pseudo-LOCALE": "en", "default": "en" }, + "pseudoLocale": "pseudo-LOCALE", "sourceLocale": "en", "format": "po", "formatOptions": { diff --git a/packages/grafana-e2e-selectors/src/selectors/components.ts b/packages/grafana-e2e-selectors/src/selectors/components.ts index a69a6b0c36a..54155ce9bf4 100644 --- a/packages/grafana-e2e-selectors/src/selectors/components.ts +++ b/packages/grafana-e2e-selectors/src/selectors/components.ts @@ -322,4 +322,10 @@ export const Components = { DashboardRow: { title: (title: string) => `data-testid dashboard-row-title-${title}`, }, + UserProfile: { + profileSaveButton: 'data-testid-user-profile-save', + preferencesSaveButton: 'data-testid-shared-prefs-save', + orgsTable: 'data-testid-user-orgs-table', + sessionsTable: 'data-testid-user-sessions-table', + }, }; diff --git a/public/app/core/components/SharedPreferences/SharedPreferences.tsx b/public/app/core/components/SharedPreferences/SharedPreferences.tsx index ecedadb50ca..c6b885c453b 100644 --- a/public/app/core/components/SharedPreferences/SharedPreferences.tsx +++ b/public/app/core/components/SharedPreferences/SharedPreferences.tsx @@ -21,6 +21,7 @@ import { selectors } from '@grafana/e2e-selectors'; import { DashboardSearchHit, DashboardSearchItemType } from 'app/features/search/types'; import { backendSrv } from 'app/core/services/backend_srv'; import { PreferencesService } from 'app/core/services/PreferencesService'; +import { t, Trans } from '@lingui/macro'; export interface Props { resourceUri: string; @@ -36,9 +37,9 @@ export interface State { } const themes: SelectableValue[] = [ - { value: '', label: 'Default' }, - { value: 'dark', label: 'Dark' }, - { value: 'light', label: 'Light' }, + { value: '', label: t({ id: 'shared-preferences.theme.default-label', message: 'Default' }) }, + { value: 'dark', label: t({ id: 'shared-preferences.theme.dark-label', message: 'Dark' }) }, + { value: 'light', label: t({ id: 'shared-preferences.theme.light-label', message: 'Light' }) }, ]; export class SharedPreferences extends PureComponent { @@ -130,12 +131,24 @@ export class SharedPreferences extends PureComponent { const { disabled } = this.props; const styles = getStyles(); + const homeDashboardTooltip = ( + + Not finding the dashboard you want? Star it first, then it should appear in this select box. + + } + > + + + ); + return (
{() => { return ( -
- +
Preferences} disabled={disabled}> + item.value === theme)?.value} @@ -146,10 +159,11 @@ export class SharedPreferences extends PureComponent { - Home Dashboard - - - + + Home Dashboard + + + {homeDashboardTooltip} } data-testid="User preferences home dashboard drop down" @@ -163,30 +177,40 @@ export class SharedPreferences extends PureComponent { this.onHomeDashboardChanged(dashboard.id) } options={dashboards} - placeholder="Choose default dashboard" + placeholder={t({ + id: 'shared-preferences.fields.home-dashboard-placeholder', + message: 'Choose default dashboard', + })} inputId="home-dashboard-select" /> - + - + +
-
diff --git a/public/app/features/admin/UserSessions.tsx b/public/app/features/admin/UserSessions.tsx index 0b9d530d981..cd7b52a7b62 100644 --- a/public/app/features/admin/UserSessions.tsx +++ b/public/app/features/admin/UserSessions.tsx @@ -3,8 +3,9 @@ import { css } from '@emotion/css'; import { ConfirmButton, ConfirmModal, Button } from '@grafana/ui'; import { AccessControlAction, UserSession } from 'app/types'; import { contextSrv } from 'app/core/core'; +import { withI18n, withI18nProps } from '@lingui/react'; -interface Props { +interface Props extends withI18nProps { sessions: UserSession[]; onSessionRevoke: (id: number) => void; @@ -15,7 +16,7 @@ interface State { showLogoutModal: boolean; } -export class UserSessions extends PureComponent { +class BaseUserSessions extends PureComponent { forceAllLogoutButton = React.createRef(); state: State = { showLogoutModal: false, @@ -43,7 +44,7 @@ export class UserSessions extends PureComponent { }; render() { - const { sessions } = this.props; + const { sessions, i18n } = this.props; const { showLogoutModal } = this.state; const logoutFromAllDevicesClass = css` @@ -71,7 +72,7 @@ export class UserSessions extends PureComponent { sessions.map((session, index) => ( {session.isActive ? 'Now' : session.seenAt} - {session.createdAt} + {i18n.date(session.createdAt, { dateStyle: 'long' })} {session.clientIp} {`${session.browser} on ${session.os} ${session.osVersion}`} @@ -113,3 +114,5 @@ export class UserSessions extends PureComponent { ); } } + +export const UserSessions = withI18n()(BaseUserSessions); diff --git a/public/app/features/admin/state/actions.ts b/public/app/features/admin/state/actions.ts index b3b60b8d2e2..55849aba080 100644 --- a/public/app/features/admin/state/actions.ts +++ b/public/app/features/admin/state/actions.ts @@ -1,5 +1,5 @@ import config from 'app/core/config'; -import { dateTimeFormat, dateTimeFormatTimeAgo } from '@grafana/data'; +import { dateTimeFormatTimeAgo } from '@grafana/data'; import { featureEnabled, getBackendSrv, locationService } from '@grafana/runtime'; import { ThunkResult, LdapUser, UserSession, UserDTO, AccessControlAction, UserFilter } from 'app/types'; @@ -144,12 +144,13 @@ export function loadUserSessions(userId: number): ThunkResult { const tokens = await getBackendSrv().get(`/api/admin/users/${userId}/auth-tokens`); tokens.reverse(); + const sessions = tokens.map((session: UserSession) => { return { id: session.id, isActive: session.isActive, seenAt: dateTimeFormatTimeAgo(session.seenAt), - createdAt: dateTimeFormat(session.createdAt, { format: 'MMMM DD, YYYY' }), + createdAt: session.createdAt, clientIp: session.clientIp, browser: session.browser, browserVersion: session.browserVersion, @@ -158,6 +159,7 @@ export function loadUserSessions(userId: number): ThunkResult { device: session.device, }; }); + dispatch(userSessionsLoadedAction(sessions)); }; } diff --git a/public/app/features/profile/UserOrganizations.tsx b/public/app/features/profile/UserOrganizations.tsx index 11e4967d4f8..288ec250492 100644 --- a/public/app/features/profile/UserOrganizations.tsx +++ b/public/app/features/profile/UserOrganizations.tsx @@ -1,6 +1,8 @@ import React, { PureComponent } from 'react'; import { UserDTO, UserOrg } from 'app/types'; import { Button, LoadingPlaceholder } from '@grafana/ui'; +import { Trans } from '@lingui/macro'; +import { selectors } from '@grafana/e2e-selectors'; export interface Props { user: UserDTO | null; @@ -23,13 +25,20 @@ export class UserOrganizations extends PureComponent { return (
-

Organizations

+

+ Organizations +

+
- +
- - + + @@ -42,7 +51,7 @@ export class UserOrganizations extends PureComponent { diff --git a/public/app/features/profile/UserProfileEditForm.tsx b/public/app/features/profile/UserProfileEditForm.tsx index f7dba171ae2..b1be3a0cf87 100644 --- a/public/app/features/profile/UserProfileEditForm.tsx +++ b/public/app/features/profile/UserProfileEditForm.tsx @@ -1,6 +1,7 @@ import React, { FC } from 'react'; -import { Trans } from '@lingui/macro'; +import { Trans, t } from '@lingui/macro'; import { Button, Field, FieldSet, Form, Icon, Input, Tooltip } from '@grafana/ui'; +import { selectors } from '@grafana/e2e-selectors'; import { UserDTO } from 'app/types'; import config from 'app/core/config'; import { ProfileUpdateFields } from './types'; @@ -22,37 +23,57 @@ export const UserProfileEditForm: FC = ({ user, isSavingUser, updateProfi {({ register, errors }) => { return ( -
Edit profile}> - +
Edit profile}> + Name is required} + disabled={disableLoginForm} + > } /> - + + Email is required} + disabled={disableLoginForm} + > } /> - + + } /> +
-
diff --git a/public/app/features/profile/UserProfileEditPage.test.tsx b/public/app/features/profile/UserProfileEditPage.test.tsx index 2907365b904..b8f3c476de6 100644 --- a/public/app/features/profile/UserProfileEditPage.test.tsx +++ b/public/app/features/profile/UserProfileEditPage.test.tsx @@ -4,6 +4,7 @@ import userEvent from '@testing-library/user-event'; import { within } from '@testing-library/dom'; import { OrgRole } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; +import TestProvider from '../../../test/helpers/TestProvider'; import { Props, UserProfileEditPage } from './UserProfileEditPage'; import { initialUserState } from './state/reducers'; @@ -90,28 +91,28 @@ function getSelectors() { const dashboardSelect = () => screen.getByTestId('User preferences home dashboard drop down'); const timepickerSelect = () => screen.getByTestId(selectors.components.TimeZonePicker.containerV2); const teamsTable = () => screen.getByRole('table', { name: /user teams table/i }); - const orgsTable = () => screen.getByRole('table', { name: /user organizations table/i }); - const sessionsTable = () => screen.getByRole('table', { name: /user sessions table/i }); + const orgsTable = () => screen.getByTestId(selectors.components.UserProfile.orgsTable); + const sessionsTable = () => screen.getByTestId(selectors.components.UserProfile.sessionsTable); return { name: () => screen.getByRole('textbox', { name: /^name$/i }), email: () => screen.getByRole('textbox', { name: /email/i }), username: () => screen.getByRole('textbox', { name: /username/i }), - saveProfile: () => screen.getByRole('button', { name: /edit user profile save button/i }), + saveProfile: () => screen.getByTestId(selectors.components.UserProfile.profileSaveButton), dashboardSelect, dashboardValue: () => within(dashboardSelect()).getByText(/default/i), timepickerSelect, timepickerValue: () => within(timepickerSelect()).getByText(/coordinated universal time/i), - savePreferences: () => screen.getByRole('button', { name: /user preferences save button/i }), + savePreferences: () => screen.getByTestId(selectors.components.UserProfile.preferencesSaveButton), teamsTable, teamsRow: () => within(teamsTable()).getByRole('row', { name: /team one team.one@test\.com 2000/i }), orgsTable, orgsEditorRow: () => within(orgsTable()).getByRole('row', { name: /main editor current/i }), - orgsViewerRow: () => within(orgsTable()).getByRole('row', { name: /second viewer select/i }), - orgsAdminRow: () => within(orgsTable()).getByRole('row', { name: /third admin select/i }), + orgsViewerRow: () => within(orgsTable()).getByRole('row', { name: /second viewer select organisation/i }), + orgsAdminRow: () => within(orgsTable()).getByRole('row', { name: /third admin select organisation/i }), sessionsTable, sessionsRow: () => within(sessionsTable()).getByRole('row', { - name: /now 2021-01-01 04:00:00 localhost chrome on mac os x 11/i, + name: /now January 1, 2021 localhost chrome on mac os x 11/i, }), }; } @@ -125,7 +126,11 @@ async function getTestContext(overrides: Partial = {}) { const searchSpy = jest.spyOn(backendSrv, 'search').mockResolvedValue([]); const props = { ...defaultProps, ...overrides }; - const { rerender } = render(); + const { rerender } = render( + + + + ); await waitFor(() => expect(props.initUserProfilePage).toHaveBeenCalledTimes(1)); @@ -253,7 +258,7 @@ describe('UserProfileEditPage', () => { const { props } = await getTestContext(); const orgsAdminSelectButton = () => within(getSelectors().orgsAdminRow()).getByRole('button', { - name: /switch to the organization named Third/i, + name: /select organisation/i, }); userEvent.click(orgsAdminSelectButton()); diff --git a/public/app/features/profile/UserSessions.tsx b/public/app/features/profile/UserSessions.tsx index 7548d89877a..5036b501450 100644 --- a/public/app/features/profile/UserSessions.tsx +++ b/public/app/features/profile/UserSessions.tsx @@ -1,19 +1,22 @@ import React, { PureComponent } from 'react'; import { UserSession } from 'app/types'; import { Button, Icon, LoadingPlaceholder } from '@grafana/ui'; +import { withI18n, withI18nProps } from '@lingui/react'; +import { t, Trans } from '@lingui/macro'; +import { selectors } from '@grafana/e2e-selectors'; -export interface Props { +interface Props extends withI18nProps { sessions: UserSession[]; isLoading: boolean; revokeUserSession: (tokenId: number) => void; } -export class UserSessions extends PureComponent { +class UserSessions extends PureComponent { render() { - const { isLoading, sessions, revokeUserSession } = this.props; + const { isLoading, sessions, revokeUserSession, i18n } = this.props; if (isLoading) { - return ; + return Loading sessions...} />; } return ( @@ -22,13 +25,21 @@ export class UserSessions extends PureComponent { <>

Sessions

-
NameRole + Name + + Role +
{org.orgId === user?.orgId ? ( ) : ( )}
+
- - - - + + + + @@ -36,7 +47,7 @@ export class UserSessions extends PureComponent { {sessions.map((session: UserSession, index) => ( {session.isActive ? : } - +
Last seenLogged onIP addressBrowser & OS + Last seen + + Logged on + + IP address + + Browser & OS +
Now{session.seenAt}{session.createdAt}{i18n.date(session.createdAt, { dateStyle: 'long' })} {session.clientIp} {session.browser} on {session.os} {session.osVersion} @@ -46,7 +57,7 @@ export class UserSessions extends PureComponent { size="sm" variant="destructive" onClick={() => revokeUserSession(session.id)} - aria-label="Revoke user session" + aria-label={t({ id: 'user-session.revoke', message: 'Revoke user session' })} > @@ -63,4 +74,4 @@ export class UserSessions extends PureComponent { } } -export default UserSessions; +export default withI18n()(UserSessions); diff --git a/public/app/features/profile/state/reducers.test.ts b/public/app/features/profile/state/reducers.test.ts index 7675515faf5..b9bcd399ab3 100644 --- a/public/app/features/profile/state/reducers.test.ts +++ b/public/app/features/profile/state/reducers.test.ts @@ -166,7 +166,7 @@ describe('userReducer', () => { browserVersion: '90', osVersion: '95', clientIp: '192.168.1.1', - createdAt: 'December 31, 2020', + createdAt: '2021-01-01 04:00:00', device: 'Computer', os: 'Windows', isActive: false, diff --git a/public/app/features/profile/state/reducers.ts b/public/app/features/profile/state/reducers.ts index 56f2ad6cc34..90bde6f695b 100644 --- a/public/app/features/profile/state/reducers.ts +++ b/public/app/features/profile/state/reducers.ts @@ -1,6 +1,6 @@ import { isEmpty, isString, set } from 'lodash'; import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { dateTimeFormat, dateTimeFormatTimeAgo, setWeekStart, TimeZone } from '@grafana/data'; +import { dateTimeFormatTimeAgo, setWeekStart, TimeZone } from '@grafana/data'; import { Team, ThunkResult, UserDTO, UserOrg, UserSession } from 'app/types'; import config from 'app/core/config'; @@ -78,7 +78,7 @@ export const slice = createSlice({ id: session.id, isActive: session.isActive, seenAt: dateTimeFormatTimeAgo(session.seenAt), - createdAt: dateTimeFormat(session.createdAt, { format: 'MMMM DD, YYYY' }), + createdAt: session.createdAt, clientIp: session.clientIp, browser: session.browser, browserVersion: session.browserVersion, diff --git a/public/locales/en/messages.po b/public/locales/en/messages.po index 3f6a978da6c..3f3c624c8b2 100644 --- a/public/locales/en/messages.po +++ b/public/locales/en/messages.po @@ -13,6 +13,118 @@ msgstr "" "Language-Team: \n" "Plural-Forms: \n" +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx #: public/app/features/profile/UserProfileEditForm.tsx -msgid "edit-user-profile.title" +msgid "common.save" +msgstr "Save" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-dashboard.fields.timezone-label" +msgstr "Timezone" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.home-dashboard-label" +msgstr "Home Dashboard" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.home-dashboard-placeholder" +msgstr "Choose default dashboard" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.home-dashboard-tooltip" +msgstr "Not finding the dashboard you want? Star it first, then it should appear in this select box." + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.theme-label" +msgstr "UI Theme" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.week-start-label" +msgstr "Week start" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.theme.dark-label" +msgstr "Dark" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.theme.default-label" +msgstr "Default" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.theme.light-label" +msgstr "Light" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.title" +msgstr "Preferences" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.current-org-button" +msgstr "Current" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.name-column" +msgstr "Name" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.role-column" +msgstr "Role" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.select-org-button" +msgstr "Select" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.title" +msgstr "Organizations" + +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.email-error" +msgstr "Email is required" + +#: public/app/features/profile/UserProfileEditForm.tsx +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.email-label" +msgstr "Email" + +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.name-error" +msgstr "Name is required" + +#: public/app/features/profile/UserProfileEditForm.tsx +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.name-label" +msgstr "Name" + +#: public/app/features/profile/UserProfileEditForm.tsx +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.username-label" +msgstr "Username" + +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.title" msgstr "Edit profile" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.browser-column" +msgstr "Browser & OS" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.created-at-column" +msgstr "Logged on" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.ip-column" +msgstr "IP address" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.revoke" +msgstr "Revoke user session" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.seen-at-column" +msgstr "Last seen" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-sessions.loading" +msgstr "Loading sessions..." diff --git a/public/locales/es/messages.po b/public/locales/es/messages.po index d6fe2e46906..7c82475b022 100644 --- a/public/locales/es/messages.po +++ b/public/locales/es/messages.po @@ -13,6 +13,118 @@ msgstr "" "Language-Team: \n" "Plural-Forms: \n" +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx #: public/app/features/profile/UserProfileEditForm.tsx -msgid "edit-user-profile.title" +msgid "common.save" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-dashboard.fields.timezone-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.home-dashboard-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.home-dashboard-placeholder" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.home-dashboard-tooltip" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.theme-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.week-start-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.theme.dark-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.theme.default-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.theme.light-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.title" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.current-org-button" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.name-column" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.role-column" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.select-org-button" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.title" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.email-error" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.email-label" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.name-error" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.name-label" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.username-label" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.title" msgstr "Editar perfil" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.browser-column" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.created-at-column" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.ip-column" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.revoke" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.seen-at-column" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-sessions.loading" +msgstr "" diff --git a/public/locales/fr/messages.po b/public/locales/fr/messages.po index 009534ecf8e..5fdba2cfafc 100644 --- a/public/locales/fr/messages.po +++ b/public/locales/fr/messages.po @@ -13,6 +13,118 @@ msgstr "" "Language-Team: \n" "Plural-Forms: \n" +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx #: public/app/features/profile/UserProfileEditForm.tsx -msgid "edit-user-profile.title" +msgid "common.save" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-dashboard.fields.timezone-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.home-dashboard-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.home-dashboard-placeholder" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.home-dashboard-tooltip" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.theme-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.week-start-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.theme.dark-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.theme.default-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.theme.light-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.title" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.current-org-button" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.name-column" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.role-column" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.select-org-button" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.title" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.email-error" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.email-label" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.name-error" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.name-label" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.username-label" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.title" msgstr "Editer le profil" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.browser-column" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.created-at-column" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.ip-column" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.revoke" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.seen-at-column" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-sessions.loading" +msgstr "" diff --git a/public/locales/pseudo-LOCALE/messages.po b/public/locales/pseudo-LOCALE/messages.po new file mode 100644 index 00000000000..d1216cb1280 --- /dev/null +++ b/public/locales/pseudo-LOCALE/messages.po @@ -0,0 +1,130 @@ +msgid "" +msgstr "" +"POT-Creation-Date: 2022-01-10 10:42+0000\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: @lingui/cli\n" +"Language: pseudo-LOCALE\n" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Plural-Forms: \n" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "common.save" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-dashboard.fields.timezone-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.home-dashboard-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.home-dashboard-placeholder" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.home-dashboard-tooltip" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.theme-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.fields.week-start-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.theme.dark-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.theme.default-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.theme.light-label" +msgstr "" + +#: public/app/core/components/SharedPreferences/SharedPreferences.tsx +msgid "shared-preferences.title" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.current-org-button" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.name-column" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.role-column" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.select-org-button" +msgstr "" + +#: public/app/features/profile/UserOrganizations.tsx +msgid "user-orgs.title" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.email-error" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.email-label" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.name-error" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.name-label" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.fields.username-label" +msgstr "" + +#: public/app/features/profile/UserProfileEditForm.tsx +msgid "user-profile.title" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.browser-column" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.created-at-column" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.ip-column" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.revoke" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-session.seen-at-column" +msgstr "" + +#: public/app/features/profile/UserSessions.tsx +msgid "user-sessions.loading" +msgstr "" diff --git a/public/test/helpers/TestProvider.tsx b/public/test/helpers/TestProvider.tsx new file mode 100644 index 00000000000..cc93f37db33 --- /dev/null +++ b/public/test/helpers/TestProvider.tsx @@ -0,0 +1,8 @@ +import React from 'react'; +import { I18nProvider } from '../../app/core/localisation'; + +const TestProvider: React.FC = ({ children }) => { + return {children}; +}; + +export default TestProvider; diff --git a/public/test/mocks/linguiMacro.tsx b/public/test/mocks/linguiMacro.tsx index c384dc66a64..9b69ccef68d 100644 --- a/public/test/mocks/linguiMacro.tsx +++ b/public/test/mocks/linguiMacro.tsx @@ -15,3 +15,7 @@ export const Select: React.FC = () => { export const SelectOrdinal: React.FC = () => { throw new Error('SelectOrdinal mock not implemented yet'); }; + +export const t = (msg: string | { message: string }) => { + return typeof msg === 'string' ? msg : msg.message; +};