chore: allow some hardcoded strings to be translated (#4076)

Allow some hardcoded strings to be translated

Also add pt-PT translation for them
pull/4088/head
Daniel Pinto 6 months ago committed by GitHub
parent 9a4fc2e015
commit f44583e87d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,6 +1,7 @@
import { Dropdown, Menu, MenuButton, MenuItem, Link } from "@mui/joy"; import { Dropdown, Menu, MenuButton, MenuItem, Link } from "@mui/joy";
import { Button } from "@usememos/mui"; import { Button } from "@usememos/mui";
import { CheckSquareIcon, Code2Icon, SquareSlashIcon } from "lucide-react"; import { CheckSquareIcon, Code2Icon, SquareSlashIcon } from "lucide-react";
import { useTranslate } from "@/utils/i18n";
import { EditorRefActions } from "../Editor"; import { EditorRefActions } from "../Editor";
interface Props { interface Props {
@ -8,6 +9,8 @@ interface Props {
} }
const MarkdownMenu = (props: Props) => { const MarkdownMenu = (props: Props) => {
const t = useTranslate();
const { editorRef } = props; const { editorRef } = props;
const handleCodeBlockClick = () => { const handleCodeBlockClick = () => {
@ -67,15 +70,15 @@ const MarkdownMenu = (props: Props) => {
<Menu className="text-sm" size="sm" placement="bottom-start"> <Menu className="text-sm" size="sm" placement="bottom-start">
<MenuItem onClick={handleCodeBlockClick}> <MenuItem onClick={handleCodeBlockClick}>
<Code2Icon className="w-4 h-auto" /> <Code2Icon className="w-4 h-auto" />
<span>Code block</span> <span>{t("markdown.code-block")}</span>
</MenuItem> </MenuItem>
<MenuItem onClick={handleCheckboxClick}> <MenuItem onClick={handleCheckboxClick}>
<CheckSquareIcon className="w-4 h-auto" /> <CheckSquareIcon className="w-4 h-auto" />
<span>Checkbox</span> <span>{t("markdown.checkbox")}</span>
</MenuItem> </MenuItem>
<div className="-mt-0.5 pl-2"> <div className="-mt-0.5 pl-2">
<Link fontSize={12} href="https://www.usememos.com/docs/getting-started/content-syntax" target="_blank"> <Link fontSize={12} href="https://www.usememos.com/docs/getting-started/content-syntax" target="_blank">
Content syntax {t("markdown.content-syntax")}
</Link> </Link>
</div> </div>
</Menu> </Menu>

@ -56,10 +56,10 @@ const AccessTokenSection = () => {
<div className="sm:flex sm:items-center sm:justify-between"> <div className="sm:flex sm:items-center sm:justify-between">
<div className="sm:flex-auto space-y-1"> <div className="sm:flex-auto space-y-1">
<p className="flex flex-row justify-start items-center font-medium text-gray-700 dark:text-gray-400"> <p className="flex flex-row justify-start items-center font-medium text-gray-700 dark:text-gray-400">
Access Tokens {t("setting.access-token-section.title")}
<LearnMore className="ml-2" url="https://usememos.com/docs/security/access-tokens" /> <LearnMore className="ml-2" url="https://usememos.com/docs/security/access-tokens" />
</p> </p>
<p className="text-sm text-gray-700 dark:text-gray-500">A list of all access tokens for your account.</p> <p className="text-sm text-gray-700 dark:text-gray-500">{t("setting.access-token-section.description")}</p>
</div> </div>
<div className="mt-4 sm:mt-0"> <div className="mt-4 sm:mt-0">
<Button <Button
@ -79,16 +79,16 @@ const AccessTokenSection = () => {
<thead> <thead>
<tr> <tr>
<th scope="col" className="px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400"> <th scope="col" className="px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400">
Token {t("setting.access-token-section.token")}
</th> </th>
<th scope="col" className="py-2 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 dark:text-gray-400"> <th scope="col" className="py-2 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 dark:text-gray-400">
Description {t("common.description")}
</th> </th>
<th scope="col" className="px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400"> <th scope="col" className="px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400">
Created At {t("setting.access-token-section.created-at")}
</th> </th>
<th scope="col" className="px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400"> <th scope="col" className="px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400">
Expires At {t("setting.access-token-section.expires-at")}
</th> </th>
<th scope="col" className="relative py-3.5 pl-3 pr-4"> <th scope="col" className="relative py-3.5 pl-3 pr-4">
<span className="sr-only">{t("common.delete")}</span> <span className="sr-only">{t("common.delete")}</span>

@ -59,7 +59,7 @@ const MemoRelatedSettings = () => {
return ( return (
<div className="w-full flex flex-col gap-2 pt-2 pb-4"> <div className="w-full flex flex-col gap-2 pt-2 pb-4">
<p className="font-medium text-gray-700 dark:text-gray-500">Memo related settings</p> <p className="font-medium text-gray-700 dark:text-gray-500">{t("setting.memo-related-settings.title")}</p>
<div className="w-full flex flex-row justify-between items-center"> <div className="w-full flex flex-row justify-between items-center">
<span>{t("setting.system-section.disable-public-memos")}</span> <span>{t("setting.system-section.disable-public-memos")}</span>
<Switch <Switch
@ -82,21 +82,21 @@ const MemoRelatedSettings = () => {
/> />
</div> </div>
<div className="w-full flex flex-row justify-between items-center"> <div className="w-full flex flex-row justify-between items-center">
<span>Enable link preview</span> <span>{t("setting.memo-related-settings.enable-link-preview")}</span>
<Switch <Switch
checked={memoRelatedSetting.enableLinkPreview} checked={memoRelatedSetting.enableLinkPreview}
onChange={(event) => updatePartialSetting({ enableLinkPreview: event.target.checked })} onChange={(event) => updatePartialSetting({ enableLinkPreview: event.target.checked })}
/> />
</div> </div>
<div className="w-full flex flex-row justify-between items-center"> <div className="w-full flex flex-row justify-between items-center">
<span>Enable memo comments</span> <span>{t("setting.memo-related-settings.enable-memo-comments")}</span>
<Switch <Switch
checked={memoRelatedSetting.enableComment} checked={memoRelatedSetting.enableComment}
onChange={(event) => updatePartialSetting({ enableComment: event.target.checked })} onChange={(event) => updatePartialSetting({ enableComment: event.target.checked })}
/> />
</div> </div>
<div className="w-full flex flex-row justify-between items-center"> <div className="w-full flex flex-row justify-between items-center">
<span>Enable memo location</span> <span>{t("setting.memo-related-settings.enable-memo-location")}</span>
<Switch <Switch
checked={memoRelatedSetting.enableLocation} checked={memoRelatedSetting.enableLocation}
onChange={(event) => updatePartialSetting({ enableLocation: event.target.checked })} onChange={(event) => updatePartialSetting({ enableLocation: event.target.checked })}
@ -117,7 +117,7 @@ const MemoRelatedSettings = () => {
/> />
</div> </div>
<div className="w-full flex flex-row justify-between items-center"> <div className="w-full flex flex-row justify-between items-center">
<span>Content length limit(Byte)</span> <span>{t("setting.memo-related-settings.content-lenght-limit")}</span>
<Input <Input
className="w-24" className="w-24"
type="number" type="number"
@ -145,7 +145,7 @@ const MemoRelatedSettings = () => {
</Select> </Select>
</div> </div>
<div className="w-full"> <div className="w-full">
<span className="truncate">Reactions</span> <span className="truncate">{t("setting.memo-related-settings.reactions")}</span>
<div className="mt-2 w-full flex flex-row flex-wrap gap-1"> <div className="mt-2 w-full flex flex-row flex-wrap gap-1">
{memoRelatedSetting.reactions.map((reactionType) => { {memoRelatedSetting.reactions.map((reactionType) => {
return ( return (

@ -76,7 +76,7 @@ const SSOSection = () => {
))} ))}
{identityProviderList.length === 0 && ( {identityProviderList.length === 0 && (
<div className="w-full mt-2 text-sm dark:border-zinc-700 opacity-60 flex flex-row items-center justify-between"> <div className="w-full mt-2 text-sm dark:border-zinc-700 opacity-60 flex flex-row items-center justify-between">
<p className="">No SSO found.</p> <p className="">{t("setting.sso-section.no-sso-found")}</p>
</div> </div>
)} )}
@ -89,7 +89,7 @@ const SSOSection = () => {
to="https://www.usememos.com/docs/advanced-settings/keycloak" to="https://www.usememos.com/docs/advanced-settings/keycloak"
target="_blank" target="_blank"
> >
Configuring Keycloak for Authentication {t("setting.sso-section.configuring-keycloak-for-authentication")}
</Link> </Link>
</ListItem> </ListItem>
</List> </List>

@ -43,7 +43,9 @@ const WebhookSection = () => {
<div className="w-full flex flex-col justify-start items-start"> <div className="w-full flex flex-col justify-start items-start">
<div className="w-full flex justify-between items-center"> <div className="w-full flex justify-between items-center">
<div className="flex-auto space-y-1"> <div className="flex-auto space-y-1">
<p className="flex flex-row justify-start items-center font-medium text-gray-700 dark:text-gray-400">Webhooks</p> <p className="flex flex-row justify-start items-center font-medium text-gray-700 dark:text-gray-400">
{t("setting.webhook-section.title")}
</p>
</div> </div>
<div> <div>
<Button <Button
@ -63,10 +65,10 @@ const WebhookSection = () => {
<thead> <thead>
<tr> <tr>
<th scope="col" className="px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400"> <th scope="col" className="px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400">
Name {t("common.name")}
</th> </th>
<th scope="col" className="px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400"> <th scope="col" className="px-3 py-2 text-left text-sm font-semibold text-gray-900 dark:text-gray-400">
Url {t("setting.webhook-section.url")}
</th> </th>
<th scope="col" className="relative px-3 py-2 pr-4"> <th scope="col" className="relative px-3 py-2 pr-4">
<span className="sr-only">{t("common.delete")}</span> <span className="sr-only">{t("common.delete")}</span>
@ -95,7 +97,7 @@ const WebhookSection = () => {
{webhooks.length === 0 && ( {webhooks.length === 0 && (
<tr> <tr>
<td className="whitespace-nowrap px-3 py-2 text-sm text-gray-900 dark:text-gray-400" colSpan={3}> <td className="whitespace-nowrap px-3 py-2 text-sm text-gray-900 dark:text-gray-400" colSpan={3}>
No webhooks found. {t("setting.webhook-section.no-webhooks-found")}
</td> </td>
</tr> </tr>
)} )}

@ -106,35 +106,35 @@ const WorkspaceSection = () => {
</Link> </Link>
</div> </div>
<div className="w-full flex flex-row justify-between items-center"> <div className="w-full flex flex-row justify-between items-center">
<span>Disallow user registration</span> <span>{t("setting.workspace-section.disallow-user-registration")}</span>
<Switch <Switch
checked={workspaceGeneralSetting.disallowUserRegistration} checked={workspaceGeneralSetting.disallowUserRegistration}
onChange={(event) => updatePartialSetting({ disallowUserRegistration: event.target.checked })} onChange={(event) => updatePartialSetting({ disallowUserRegistration: event.target.checked })}
/> />
</div> </div>
<div className="w-full flex flex-row justify-between items-center"> <div className="w-full flex flex-row justify-between items-center">
<span>Disallow password auth</span> <span>{t("setting.workspace-section.disallow-password-auth")}</span>
<Switch <Switch
checked={workspaceGeneralSetting.disallowPasswordAuth} checked={workspaceGeneralSetting.disallowPasswordAuth}
onChange={(event) => updatePartialSetting({ disallowPasswordAuth: event.target.checked })} onChange={(event) => updatePartialSetting({ disallowPasswordAuth: event.target.checked })}
/> />
</div> </div>
<div className="w-full flex flex-row justify-between items-center"> <div className="w-full flex flex-row justify-between items-center">
<span>Disallow Change Username</span> <span>{t("setting.workspace-section.disallow-change-username")}</span>
<Switch <Switch
checked={workspaceGeneralSetting.disallowChangeUsername} checked={workspaceGeneralSetting.disallowChangeUsername}
onChange={(event) => updatePartialSetting({ disallowChangeUsername: event.target.checked })} onChange={(event) => updatePartialSetting({ disallowChangeUsername: event.target.checked })}
/> />
</div> </div>
<div className="w-full flex flex-row justify-between items-center"> <div className="w-full flex flex-row justify-between items-center">
<span>Disallow Change Nickname</span> <span>{t("setting.workspace-section.disallow-change-nickname")}</span>
<Switch <Switch
checked={workspaceGeneralSetting.disallowChangeNickname} checked={workspaceGeneralSetting.disallowChangeNickname}
onChange={(event) => updatePartialSetting({ disallowChangeNickname: event.target.checked })} onChange={(event) => updatePartialSetting({ disallowChangeNickname: event.target.checked })}
/> />
</div> </div>
<div className="w-full flex flex-row justify-between items-center"> <div className="w-full flex flex-row justify-between items-center">
<span className="truncate">Week start day</span> <span className="truncate">{t("setting.workspace-section.week-start-day")}</span>
<Select <Select
className="!min-w-fit" className="!min-w-fit"
value={workspaceGeneralSetting.weekStartDayOffset} value={workspaceGeneralSetting.weekStartDayOffset}
@ -142,9 +142,9 @@ const WorkspaceSection = () => {
updatePartialSetting({ weekStartDayOffset: weekStartDayOffset || 0 }); updatePartialSetting({ weekStartDayOffset: weekStartDayOffset || 0 });
}} }}
> >
<Option value={-1}>Saturday</Option> <Option value={-1}>{t("setting.workspace-section.saturday")}</Option>
<Option value={0}>Sunday</Option> <Option value={0}>{t("setting.workspace-section.sunday")}</Option>
<Option value={1}>Monday</Option> <Option value={1}>{t("setting.workspace-section.monday")}</Option>
</Select> </Select>
</div> </div>
<div className="mt-2 w-full flex justify-end"> <div className="mt-2 w-full flex justify-end">

@ -235,7 +235,9 @@
"template": "Template", "template": "Template",
"token-endpoint": "Token endpoint", "token-endpoint": "Token endpoint",
"update-sso": "Update SSO", "update-sso": "Update SSO",
"user-endpoint": "User endpoint" "user-endpoint": "User endpoint",
"no-sso-found": "No SSO found.",
"configuring-keycloak-for-authentication": "Configuring Keycloak for Authentication"
}, },
"storage": "Storage", "storage": "Storage",
"storage-section": { "storage-section": {
@ -299,7 +301,38 @@
"max-upload-size-hint": "Recommended value is 32 MiB.", "max-upload-size-hint": "Recommended value is 32 MiB.",
"server-name": "Server Name" "server-name": "Server Name"
}, },
"memo-related": "Memo" "memo-related": "Memo",
"access-token-section":{
"title": "Access Tokens",
"description": "A list of all access tokens for your account.",
"created-at": "Created At",
"expires-at": "Expires At",
"token": "Token"
},
"webhook-section": {
"title": "Webhooks",
"url": "Url",
"no-webhooks-found": "No webhooks found."
},
"workspace-section": {
"disallow-user-registration": "Disallow user registration",
"disallow-password-auth": "Disallow password auth",
"disallow-change-username": "Disallow Change Username",
"disallow-change-nickname": "Disallow Change Nickname",
"week-start-day": "Week start day",
"saturday": "Saturday",
"sunday": "Sunday",
"monday": "Monday"
},
"memo-related-settings": {
"title": "Memo related settings",
"enable-link-preview": "Enable link preview",
"enable-memo-comments": "Enable memo comments",
"enable-memo-location": "Enable memo location",
"content-lenght-limit": "Content length limit(Byte)",
"reactions": "Reactions"
},
"version": "Version"
}, },
"tag": { "tag": {
"all-tags": "All Tags", "all-tags": "All Tags",
@ -308,5 +341,10 @@
"delete-confirm": "Are you sure to delete this tag? All related memos will be archived.", "delete-confirm": "Are you sure to delete this tag? All related memos will be archived.",
"delete-tag": "Delete Tag", "delete-tag": "Delete Tag",
"no-tag-found": "No tag found" "no-tag-found": "No tag found"
},
"markdown": {
"code-block": "Code block",
"checkbox": "Checkbox",
"content-syntax": "Content syntax"
} }
} }

@ -235,7 +235,9 @@
"template": "Modelo", "template": "Modelo",
"token-endpoint": "Ponto de Token", "token-endpoint": "Ponto de Token",
"update-sso": "Atualizar SSO", "update-sso": "Atualizar SSO",
"user-endpoint": "Ponto do Utilizador" "user-endpoint": "Ponto do Utilizador",
"no-sso-found": "Nenhum SSO encontrado.",
"configuring-keycloak-for-authentication": "A configurar o Keycloak para autenticação."
}, },
"storage": "Armazenamento", "storage": "Armazenamento",
"storage-section": { "storage-section": {
@ -299,7 +301,38 @@
"max-upload-size-hint": "32 MiB é recomendado.", "max-upload-size-hint": "32 MiB é recomendado.",
"server-name": "Nome do Servidor" "server-name": "Nome do Servidor"
}, },
"memo-related": "Memo" "memo-related": "Memo",
"access-token-section": {
"title": "Tokens de Acesso",
"description": "Uma lista de todos os tokens de acesso para a sua conta.",
"created-at": "Criado Em",
"expires-at": "Expira Em",
"token": "Token"
},
"webhook-section": {
"title": "Webhooks",
"url": "Url",
"no-webhooks-found": "Nenhum webhook encontrado."
},
"workspace-section": {
"disallow-user-registration": "Desativar registo de utilizadores",
"disallow-password-auth": "Desativar autenticação por palavra-passe",
"disallow-change-username": "Desativar alteração de nome de utilizador",
"disallow-change-nickname": "Desativar alteração de nome ou apelido",
"week-start-day": "Dia de início da semana",
"saturday": "Sábado",
"sunday": "Domingo",
"monday": "Segunda-feira"
},
"memo-related-settings": {
"title": "Definições relacionadas com memos",
"enable-link-preview": "Ativar pré-visualização de links",
"enable-memo-comments": "Ativar comentários em memos",
"enable-memo-location": "Ativar localização em memos",
"content-lenght-limit": "Limite de comprimento do conteúdo (Bytes)",
"reactions": "Reações"
},
"version": "Versão"
}, },
"tag": { "tag": {
"all-tags": "Todas as Etiquetas", "all-tags": "Todas as Etiquetas",
@ -308,5 +341,10 @@
"delete-confirm": "Tem a certeza que quer eliminar esta etiqueta? Memos associados serão arquivados.", "delete-confirm": "Tem a certeza que quer eliminar esta etiqueta? Memos associados serão arquivados.",
"delete-tag": "Eliminar Etiqueta", "delete-tag": "Eliminar Etiqueta",
"no-tag-found": "Nenhuma etiqueta encontrada" "no-tag-found": "Nenhuma etiqueta encontrada"
},
"markdown": {
"code-block": "Bloco de código",
"checkbox": "Caixa de seleção",
"content-syntax": "Sintaxe de conteúdo"
} }
} }

@ -114,7 +114,9 @@ const Setting = () => {
onClick={() => handleSectionSelectorItemClick(item)} onClick={() => handleSectionSelectorItemClick(item)}
/> />
))} ))}
<span className="px-3 mt-2 opacity-70 text-sm">Version: v{commonContext.profile.version}</span> <span className="px-3 mt-2 opacity-70 text-sm">
{t("setting.version")}: v{commonContext.profile.version}
</span>
</div> </div>
</> </>
) : null} ) : null}

Loading…
Cancel
Save