0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor: optmize phrases (#5936)

This commit is contained in:
Gao Sun 2024-05-29 19:46:52 +08:00 committed by GitHub
parent c5099a3578
commit a0bcc8340f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 12 additions and 26 deletions

View file

@ -120,7 +120,6 @@
"remark-gfm": "^4.0.0", "remark-gfm": "^4.0.0",
"stylelint": "^15.0.0", "stylelint": "^15.0.0",
"swr": "^2.2.0", "swr": "^2.2.0",
"titleize": "^4.0.0",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"tslib": "^2.4.1", "tslib": "^2.4.1",
"typescript": "^5.3.3", "typescript": "^5.3.3",

View file

@ -81,9 +81,7 @@ function PlanCardItem({ plan, onSelect }: Props) {
<Button <Button
title={ title={
<DangerousRaw> <DangerousRaw>
<Trans components={{ name: <PlanName isTitleCase name={planName} /> }}> <Trans components={{ name: <PlanName name={planName} /> }}>{t('select_plan')}</Trans>
{t('select_plan')}
</Trans>
</DangerousRaw> </DangerousRaw>
} }
disabled={isFreePlan && isFreeTenantExceeded} disabled={isFreePlan && isFreeTenantExceeded}

View file

@ -1,6 +1,5 @@
import { type TFuncKey } from 'i18next'; import { type TFuncKey } from 'i18next';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import titleize from 'titleize';
import { ReservedPlanName } from '@/types/subscriptions'; import { ReservedPlanName } from '@/types/subscriptions';
@ -17,10 +16,9 @@ const registeredPlanNamePhraseMap: Record<
type Props = { type Props = {
readonly name: string; readonly name: string;
readonly isTitleCase?: boolean;
}; };
function PlanName({ name, isTitleCase = false }: Props) { function PlanName({ name }: Props) {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console.subscription' }); const { t } = useTranslation(undefined, { keyPrefix: 'admin_console.subscription' });
const planNamePhrase = registeredPlanNamePhraseMap[name]; const planNamePhrase = registeredPlanNamePhraseMap[name];
@ -29,7 +27,7 @@ function PlanName({ name, isTitleCase = false }: Props) {
*/ */
const planName = planNamePhrase ? String(t(planNamePhrase)) : name; const planName = planNamePhrase ? String(t(planNamePhrase)) : name;
return <span>{isTitleCase ? titleize(planName) : planName}</span>; return <span>{planName}</span>;
} }
export default PlanName; export default PlanName;

View file

@ -4,7 +4,7 @@ import quota_table from './quota-table.js';
const subscription = { const subscription = {
free_plan: 'Kostenloser Plan', free_plan: 'Kostenloser Plan',
free_plan_description: 'Für Nebenprojekte und erste Logto-Tests. Keine Kreditkarte erforderlich.', free_plan_description: 'Für Nebenprojekte und erste Logto-Tests. Keine Kreditkarte erforderlich.',
pro_plan: 'Pro Plan', pro_plan: 'Pro plan',
pro_plan_description: 'Für Unternehmen, die sorgenfrei von Logto profitieren möchten.', pro_plan_description: 'Für Unternehmen, die sorgenfrei von Logto profitieren möchten.',
enterprise: 'Unternehmen', enterprise: 'Unternehmen',
current_plan: 'Aktueller Plan', current_plan: 'Aktueller Plan',
@ -56,7 +56,7 @@ const subscription = {
upgrade_title: 'Freundliche Erinnerung für unsere geschätzten Early Adopters', upgrade_title: 'Freundliche Erinnerung für unsere geschätzten Early Adopters',
upgrade_description: upgrade_description:
'Sie nutzen derzeit mehr als das, was <name /> erlaubt. Logto ist nun offiziell und bietet Funktionen, die auf jeden Tarif zugeschnitten sind. Bevor Sie ein Upgrade auf den <name /> in Betracht ziehen, stellen Sie sicher, dass Sie die folgenden Kriterien für das Upgrade erfüllen.', 'Sie nutzen derzeit mehr als das, was <name /> erlaubt. Logto ist nun offiziell und bietet Funktionen, die auf jeden Tarif zugeschnitten sind. Bevor Sie ein Upgrade auf den <name /> in Betracht ziehen, stellen Sie sicher, dass Sie die folgenden Kriterien für das Upgrade erfüllen.',
upgrade_pro_tip: ' Oder erwägen Sie ein Upgrade auf den Pro Plan.', upgrade_pro_tip: ' Oder erwägen Sie ein Upgrade auf den Pro plan.',
upgrade_help_tip: 'Hilfe beim Upgrade benötigt? <a>Kontaktieren Sie uns</a>.', upgrade_help_tip: 'Hilfe beim Upgrade benötigt? <a>Kontaktieren Sie uns</a>.',
a_maximum_of: 'Maximal <item/>', a_maximum_of: 'Maximal <item/>',
}, },

View file

@ -7,7 +7,7 @@ const subscription = {
pro_plan: 'Pro plan', pro_plan: 'Pro plan',
pro_plan_description: 'For businesses benefit worry-free with Logto.', pro_plan_description: 'For businesses benefit worry-free with Logto.',
enterprise: 'Enterprise', enterprise: 'Enterprise',
current_plan: 'Current Plan', current_plan: 'Current plan',
current_plan_description: current_plan_description:
'Heres your current plan. You can easily see your plan usage, check your upcoming bill, and make changes to your plan as needed.', 'Heres your current plan. You can easily see your plan usage, check your upcoming bill, and make changes to your plan as needed.',
plan_usage: 'Plan usage', plan_usage: 'Plan usage',
@ -16,7 +16,7 @@ const subscription = {
next_bill_hint: 'To learn more about the calculation, please refer to this <a>article</a>.', next_bill_hint: 'To learn more about the calculation, please refer to this <a>article</a>.',
next_bill_tip: next_bill_tip:
'The prices displayed here are tax-exclusive. The tax amount will be calculated based on the information you provide and your local regulatory requirements, and will be shown in your invoices.', 'The prices displayed here are tax-exclusive. The tax amount will be calculated based on the information you provide and your local regulatory requirements, and will be shown in your invoices.',
manage_payment: 'Manage Payment', manage_payment: 'Manage payment',
overfill_quota_warning: overfill_quota_warning:
'You have reached your quota limit. To prevent any issues, upgrade the plan.', 'You have reached your quota limit. To prevent any issues, upgrade the plan.',
upgrade_pro: 'Upgrade pro', upgrade_pro: 'Upgrade pro',
@ -56,7 +56,7 @@ const subscription = {
upgrade_title: 'Friendly reminder for our honoured early adopters', upgrade_title: 'Friendly reminder for our honoured early adopters',
upgrade_description: upgrade_description:
'Youre currently using more than what the <name /> allows. Logto is now official, including features tailored to each plan. Before you consider upgrading to the <name />, make sure you meet the following criteria before upgrading.', 'Youre currently using more than what the <name /> allows. Logto is now official, including features tailored to each plan. Before you consider upgrading to the <name />, make sure you meet the following criteria before upgrading.',
upgrade_pro_tip: ' Or considering upgrading to Pro Plan.', upgrade_pro_tip: ' Or considering upgrading to Pro plan.',
upgrade_help_tip: 'Need help upgrading? <a>Contact us</a>.', upgrade_help_tip: 'Need help upgrading? <a>Contact us</a>.',
a_maximum_of: 'A maximum of <item/>', a_maximum_of: 'A maximum of <item/>',
}, },

View file

@ -78,7 +78,7 @@ const tenants = {
delete_button: 'Permanently delete', delete_button: 'Permanently delete',
cannot_delete_title: 'Cannot delete this tenant', cannot_delete_title: 'Cannot delete this tenant',
cannot_delete_description: cannot_delete_description:
"Sorry, you can't delete this tenant right now. Please make sure you're on the Free Plan and have paid all outstanding billings.", "Sorry, you can't delete this tenant right now. Please make sure you're on the Free plan and have paid all outstanding billings.",
}, },
leave_tenant_modal: { leave_tenant_modal: {
description: 'Are you sure you want to leave this tenant?', description: 'Are you sure you want to leave this tenant?',

View file

@ -5,7 +5,7 @@ const subscription = {
free_plan: 'Ücretsiz Plan', free_plan: 'Ücretsiz Plan',
free_plan_description: free_plan_description:
'Yan projeler ve başlangıç Logto denemeleri için. Kredi kartı gerektirmez.', 'Yan projeler ve başlangıç Logto denemeleri için. Kredi kartı gerektirmez.',
pro_plan: 'Pro Plan', pro_plan: 'Pro plan',
pro_plan_description: "Endişesiz bir şekilde Logto'dan faydalanan işletmeler için.", pro_plan_description: "Endişesiz bir şekilde Logto'dan faydalanan işletmeler için.",
enterprise: 'Kurumsal', enterprise: 'Kurumsal',
current_plan: 'Mevcut Plan', current_plan: 'Mevcut Plan',
@ -58,7 +58,7 @@ const subscription = {
upgrade_title: 'Saygıdeğer erken benimseyenlerimiz için dostane hatırlatma', upgrade_title: 'Saygıdeğer erken benimseyenlerimiz için dostane hatırlatma',
upgrade_description: upgrade_description:
"Şu anda <name /> tarafından izin verilenden daha fazlasını kullanıyorsunuz. Logto artık resmi olarak kullanılabilir durumda ve her plana özel özellikler sunuyor. <name />'e yükseltmeyi düşünmeden önce, yükseltme öncesinde aşağıdaki kriterleri karşıladığınızdan emin olun.", "Şu anda <name /> tarafından izin verilenden daha fazlasını kullanıyorsunuz. Logto artık resmi olarak kullanılabilir durumda ve her plana özel özellikler sunuyor. <name />'e yükseltmeyi düşünmeden önce, yükseltme öncesinde aşağıdaki kriterleri karşıladığınızdan emin olun.",
upgrade_pro_tip: " Ya da Pro Plan'a geçmeyi düşünün.", upgrade_pro_tip: " Ya da Pro plan'a geçmeyi düşünün.",
upgrade_help_tip: upgrade_help_tip:
'Yükseltme konusunda yardıma mı ihtiyacınız var? <a>Bizimle iletişime geçin</a>.', 'Yükseltme konusunda yardıma mı ihtiyacınız var? <a>Bizimle iletişime geçin</a>.',
a_maximum_of: '<item/> için maksimum', a_maximum_of: '<item/> için maksimum',

View file

@ -3133,9 +3133,6 @@ importers:
swr: swr:
specifier: ^2.2.0 specifier: ^2.2.0
version: 2.2.0(react@18.2.0) version: 2.2.0(react@18.2.0)
titleize:
specifier: ^4.0.0
version: 4.0.0
ts-node: ts-node:
specifier: ^10.9.2 specifier: ^10.9.2
version: 10.9.2(@swc/core@1.3.52(@swc/helpers@0.5.1))(@types/node@20.12.7)(typescript@5.3.3) version: 10.9.2(@swc/core@1.3.52(@swc/helpers@0.5.1))(@types/node@20.12.7)(typescript@5.3.3)
@ -12292,10 +12289,6 @@ packages:
resolution: {integrity: sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==} resolution: {integrity: sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==}
engines: {node: '>=14.0.0'} engines: {node: '>=14.0.0'}
titleize@4.0.0:
resolution: {integrity: sha512-ZgUJ1K83rhdu7uh7EHAC2BgY5DzoX8V5rTvoWI4vFysggi6YjLe5gUXABPWAU7VkvGP7P/0YiWq+dcPeYDsf1g==}
engines: {node: '>=18'}
tmp@0.0.33: tmp@0.0.33:
resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==}
engines: {node: '>=0.6.0'} engines: {node: '>=0.6.0'}
@ -15684,7 +15677,7 @@ snapshots:
deepmerge: 4.3.1 deepmerge: 4.3.1
is-builtin-module: 3.2.1 is-builtin-module: 3.2.1
is-module: 1.0.0 is-module: 1.0.0
resolve: 1.22.8 resolve: 1.22.2
optionalDependencies: optionalDependencies:
rollup: 4.14.3 rollup: 4.14.3
@ -23629,8 +23622,6 @@ snapshots:
tinyspy@2.2.1: {} tinyspy@2.2.1: {}
titleize@4.0.0: {}
tmp@0.0.33: tmp@0.0.33:
dependencies: dependencies:
os-tmpdir: 1.0.2 os-tmpdir: 1.0.2