Skip to content

Commit

Permalink
chore: Translate more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Oct 26, 2023
1 parent 6838333 commit edcf454
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 73 deletions.
33 changes: 21 additions & 12 deletions src/locales/en-US/app.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
#
# - MenuItem
# ID convention: "module-ComponentName--string-summary--MenuItem"
# Formatting: <icon></icon><wrapper>TEXT GOES HERE!</wrapper><emblem></emblem>
# Formatting: { -icon }<wrapper>TEXT GOES HERE!</wrapper>{ -emblem }
# Attrs:
# - title
# - Icon
# ID convention: "module-ComponentName--string-summary--Icon"
# Formatting: <icon></icon>TEXT GOES HERE!
# Formatting: { -icon }TEXT GOES HERE!

### Terms
# You don't need to add every new term here, just add if needed (e.g. the term is commonly used).
Expand All @@ -30,11 +32,13 @@
*[title] Collapse
[lower] collapse
}
-emblem = <emblem></emblem>
-expand =
{ $case ->
*[title] Expand
[lower] expand
}
-icon = <icon></icon>
### Modules

Expand All @@ -60,17 +64,22 @@ ui-CardHeader--back =
account-Badge--admin = Admin
account-Badge--bot = Bot
account-Badge--moderator = Moderator
-birthday-date =
{ $suffix ->
*[icon] <icon></icon>{ DATETIME($date, year: "numeric", month: "short", day: "numeric") }
[text] Born { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
}
account-Birthday--date--Icon = { -birthday-date(suffix: "icon") }
.title = { -birthday-date(suffix: "text") }
account-Birthday--date = { -birthday-date(suffix: "text") }
.title = { -birthday-date(suffix: "text") }
account-Birthday--date--Icon = { -icon }{ DATETIME($date, year: "numeric", month: "short", day: "numeric") }
.title = Born { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
account-Birthday--date = Born { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
.title = Born { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
account-Birthday--celebration = Birthday is today!
account-Header--manage-list--MenuItem = <icon></icon><wrapper>Add or Remove from lists</wrapper><emblem></emblem>
account-Header--manage-list--MenuItem = { -icon }<wrapper>Add or Remove from lists</wrapper>{ -emblem }
.title = Add or Remove from lists
account-Status--block = Blocked
account-StatusAction--block = Block @{ $name }
account-StatusAction--block--MenuItem = { -icon }<wrapper>Block @{ $name }</wrapper>{ -emblem }
.title = Block @{ $name }
account-StatusAction--block-domain--MenuItem = { -icon }<wrapper>Hide everything from { $domain }</wrapper>{ -emblem }
.title = Hide everything from { $domain }
account-StatusAction--follow = Follow
account-StatusAction--unblock = Unblock @{ $name }
account-StatusAction--unfollow = Unfollow
account-birthday-today = Birthday is today!
account-block = Block @{ $name }
Expand Down
26 changes: 16 additions & 10 deletions src/locales/id-ID/app.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Terms
-brand-name = Ghostbox
-emblem = <emblem></emblem>
-icon = <icon></icon>
### Modules

Expand All @@ -26,17 +28,21 @@ ui-CardHeader--back =

# Components that related to Account such as profile, hover card.

-birthday-date =
{ $suffix ->
*[icon] <icon></icon>{ DATETIME($date, year: "numeric", month: "short", day: "numeric") }
[text] Lahir tanggal { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
}
account-Birthday--date--Icon = { -birthday-date(suffix: "icon") }
.title = { -birthday-date(suffix: "text") }
account-Birthday--date = { -birthday-date(suffix: "text") }
.title = { -birthday-date(suffix: "text") }
account-Birthday--date--Icon = { -icon }{ DATETIME($date, year: "numeric", month: "short", day: "numeric") }
.title = Lahir tanggal { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
account-Birthday--date = Lahir tanggal { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
.title = Lahir tanggal { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
account-Birthday--celebration = Lahir hari ini!
account-Header--manage-list--MenuItem = <icon></icon><wrapper>Tambah atau Hapus dari daftar</wrapper><emblem></emblem>
account-Header--manage-list--MenuItem = { -icon }<wrapper>Tambah atau Hapus dari daftar</wrapper>{ -emblem }
.title = Tambah atau Hapus dari daftar
account-StatusAction--block = Blokir @{ $name }
account-StatusAction--block--MenuItem = { -icon }<wrapper>Blokir @{ $name }</wrapper>{ -emblem }
.title = Blokir @{ $name }
account-StatusAction--block-domain--MenuItem = { -icon }<wrapper>Sembunyikan segalanya dari { $domain }</wrapper>{ -emblem }
.title = Sembunyikan segalanya dari { $domain }
account-StatusAction--follow = Ikuti
account-StatusAction--unblock = Hapus blokir @{ $name }
account-StatusAction--unfollow = Berhenti mengikuti
account-birthday = Born { $date }
account-birthday-today = Birthday is today!
Expand Down
27 changes: 17 additions & 10 deletions src/locales/ja-JP/app.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Terms
-brand-name = Ghostbox
-emblem = <emblem></emblem>
-icon = <icon></icon>
### Modules

Expand All @@ -26,17 +28,22 @@ ui-CardHeader--back =

# Components that related to Account such as profile, hover card.

-birthday-date =
{ $suffix ->
*[icon] <icon></icon>{ DATETIME($date, year: "numeric", month: "short", day: "numeric") }
[text] 生年月日 { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
}
account-Birthday--date--Icon = { -birthday-date(suffix: "icon") }
.title = { -birthday-date(suffix: "text") }
account-Birthday--date = { -birthday-date(suffix: "text") }
.title = { -birthday-date(suffix: "text") }
account-Birthday--date--Icon = { -icon }{ DATETIME($date, year: "numeric", month: "short", day: "numeric") }
.title = 生年月日 { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
account-Birthday--date = 生年月日 { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
.title = 生年月日 { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
account-Birthday--celebration = 本日は誕生日です!
account-Header--manage-list--MenuItem = <icon></icon><wrapper>リストから追加または外す</wrapper><emblem></emblem>
account-Header--manage-list--MenuItem = { -icon }<wrapper>リストから追加または外す</wrapper>{ -emblem }
.title = リストから追加または外す
account-Status--block = ブロック済み
account-StatusAction--block = @{ $name }さんをブロック
account-StatusAction--block--MenuItem = { -icon }<wrapper>@{ $name }さんをブロック</wrapper>{ -emblem }
.title = @{ $name }さんをブロック
account-StatusAction--block-domain--MenuItem = { -icon }<wrapper>{ $domain }全体を非表示</wrapper>{ -emblem }
.title = { $domain }全体を非表示
account-StatusAction--follow = フォロー
account-StatusAction--unblock = @{ $name }さんのブロックを解除
account-StatusAction--unfollow = フォロー解除
account-block = Block @{ $name }
account-block-domain = Hide everything from { $domain }
Expand Down
14 changes: 11 additions & 3 deletions src/soapbox/components/status-action-bar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Localized } from '@fluent/react';
import { List as ImmutableList } from 'immutable';
import React from 'react';
import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
Expand Down Expand Up @@ -34,7 +35,6 @@ import type { Account, Group, Status } from 'soapbox/types/entities';
const messages = defineMessages({
adminAccount: { id: 'status.admin_account', defaultMessage: 'Moderate @{name}' },
admin_status: { id: 'status.admin_status', defaultMessage: 'Open this post in the moderation interface' },
block: { id: 'account.block', defaultMessage: 'Block @{name}' },
blocked: { id: 'group.group_mod_block.success', defaultMessage: '@{name} is banned' },
blockAndReport: { id: 'confirmations.block.block_and_report', defaultMessage: 'Block & Report' },
blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' },
Expand Down Expand Up @@ -308,7 +308,11 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({

dispatch(openModal('CONFIRM', {
icon: require('@tabler/icons/ban.svg'),
heading: <FormattedMessage id='confirmations.block.heading' defaultMessage='Block @{name}' values={{ name: account.acct }} />,
heading: (
<Localized id='account-StatusAction--block' vars={{ name: account.acct }}>
<span>Block @{account.acct}</span>
</Localized>
),
message: <FormattedMessage id='confirmations.block.message' defaultMessage='Are you sure you want to block {name}?' values={{ name: <strong className='break-words'>@{account.acct}</strong> }} />,
confirm: intl.formatMessage(messages.blockConfirm),
onConfirm: () => dispatch(blockAccount(account.id)),
Expand Down Expand Up @@ -540,7 +544,11 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
icon: require('@tabler/icons/volume-3.svg'),
});
menu.push({
text: intl.formatMessage(messages.block, { name: username }),
fluent: {
id: 'account-StatusAction--block--MenuItem',
vars: { name: username },
},
text: `Block @${username}`,
action: handleBlockClick,
icon: require('@tabler/icons/ban.svg'),
});
Expand Down
21 changes: 16 additions & 5 deletions src/soapbox/features/account/components/header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

import { Localized } from '@fluent/react';
import { useMutation } from '@tanstack/react-query';
import { AxiosError } from 'axios';
import { List as ImmutableList } from 'immutable';
Expand Down Expand Up @@ -42,14 +43,12 @@ const messages = defineMessages({
chat: { id: 'account.chat', defaultMessage: 'Chat with @{name}' },
direct: { id: 'account.direct', defaultMessage: 'Direct message @{name}' },
unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' },
block: { id: 'account.block', defaultMessage: 'Block @{name}' },
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' },
report: { id: 'account.report', defaultMessage: 'Report @{name}' },
copy: { id: 'account.copy', defaultMessage: 'Copy link to profile' },
share: { id: 'account.share', defaultMessage: 'Share @{name}\'s profile' },
media: { id: 'account.media', defaultMessage: 'Media' },
blockDomain: { id: 'account.block_domain', defaultMessage: 'Hide everything from {domain}' },
unblockDomain: { id: 'account.unblock_domain', defaultMessage: 'Unhide {domain}' },
hideReblogs: { id: 'account.hide_reblogs', defaultMessage: 'Hide reposts from @{name}' },
showReblogs: { id: 'account.show_reblogs', defaultMessage: 'Show reposts from @{name}' },
Expand Down Expand Up @@ -447,7 +446,11 @@ const Header: React.FC<IHeader> = ({ account }) => {
});
} else {
menu.push({
text: intl.formatMessage(messages.block, { name: account.username }),
fluent: {
id: 'account-StatusAction--block--MenuItem',
vars: { name: account.username },
},
text: `Block @${account.username}`,
action: onBlock,
icon: require('@tabler/icons/ban.svg'),
});
Expand All @@ -473,7 +476,11 @@ const Header: React.FC<IHeader> = ({ account }) => {
});
} else {
menu.push({
text: intl.formatMessage(messages.blockDomain, { domain }),
fluent: {
id: 'account-StatusAction--block-domain--MenuItem',
vars: { domain },
},
text: `Hide everything from ${domain}`,
action: () => onBlockDomain(domain),
icon: require('@tabler/icons/ban.svg'),
});
Expand Down Expand Up @@ -511,7 +518,11 @@ const Header: React.FC<IHeader> = ({ account }) => {
<Badge
key='blocked'
slug='opaque'
title={<FormattedMessage id='account.blocked' defaultMessage='Blocked' />}
title={
<Localized id='account-Status--block'>
<span>Blocked</span>
</Localized>
}
/>,
);
}
Expand Down
7 changes: 5 additions & 2 deletions src/soapbox/features/event/components/event-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const messages = defineMessages({
chat: { id: 'status.chat', defaultMessage: 'Chat with @{name}' },
direct: { id: 'status.direct', defaultMessage: 'Direct message @{name}' },
mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' },
block: { id: 'account.block', defaultMessage: 'Block @{name}' },
report: { id: 'status.report', defaultMessage: 'Report @{name}' },
adminAccount: { id: 'status.admin_account', defaultMessage: 'Moderate @{name}' },
adminStatus: { id: 'status.admin_status', defaultMessage: 'Open this post in the moderation interface' },
Expand Down Expand Up @@ -296,7 +295,11 @@ const EventHeader: React.FC<IEventHeader> = ({ status }) => {
icon: require('@tabler/icons/circle-x.svg'),
});
menu.push({
text: intl.formatMessage(messages.block, { name: username }),
fluent: {
id: 'account-StatusAction--block--MenuItem',
vars: { name: username },
},
text: `Block @${username}`,
action: handleBlockClick,
icon: require('@tabler/icons/ban.svg'),
});
Expand Down
67 changes: 36 additions & 31 deletions src/soapbox/features/ui/components/action-button.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Localized } from '@fluent/react';
import React from 'react';
import { defineMessages, useIntl } from 'react-intl';

Expand All @@ -17,15 +18,11 @@ import { useAppDispatch, useFeatures, useLoggedIn } from 'soapbox/hooks';
import type { Account } from 'soapbox/schemas';

const messages = defineMessages({
block: { id: 'account.block', defaultMessage: 'Block @{name}' },
blocked: { id: 'account.blocked', defaultMessage: 'Blocked' },
edit_profile: { id: 'account.edit_profile', defaultMessage: 'Edit profile' },
follow: { id: 'account.follow', defaultMessage: 'Follow' },
mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' },
remote_follow: { id: 'account.remote_follow', defaultMessage: 'Remote follow' },
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval' },
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
unmute: { id: 'account.unmute', defaultMessage: 'Unmute @{name}' },
authorize: { id: 'follow_request.authorize', defaultMessage: 'Authorize' },
reject: { id: 'follow_request.reject', defaultMessage: 'Reject' },
Expand Down Expand Up @@ -112,16 +109,17 @@ const ActionButton: React.FC<IActionButton> = ({ account, actionType, small }) =
/** Handles actionType='blocking' */
const blockingAction = () => {
const isBlocked = account.relationship?.blocking;
const messageKey = isBlocked ? messages.unblock : messages.block;
const text = intl.formatMessage(messageKey, { name: account.username });

return (
<Button
theme={isBlocked ? 'danger' : 'secondary'}
size='sm'
text={text}
onClick={handleBlock}
/>
<Localized id={'account-StatusAction--' + (isBlocked ? 'unblock' : 'block')} vars={{ name: account.username }}>
<Button
theme={isBlocked ? 'danger' : 'secondary'}
size='sm'
onClick={handleBlock}
>
Block/Unblock @{account.username}
</Button>
</Localized>
);
};

Expand Down Expand Up @@ -151,12 +149,15 @@ const ActionButton: React.FC<IActionButton> = ({ account, actionType, small }) =
// Remote follow through the API.
if (features.remoteInteractions) {
return (
<Button
onClick={handleRemoteFollow}
icon={require('@tabler/icons/plus.svg')}
text={intl.formatMessage(messages.follow)}
size='sm'
/>
<Localized id='account-StatusAction--follow'>
<Button
onClick={handleRemoteFollow}
icon={require('@tabler/icons/plus.svg')}
size='sm'
>
Follow
</Button>
</Localized>
);
// Pleroma's classic remote follow form.
} else if (features.pleromaRemoteFollow) {
Expand Down Expand Up @@ -219,19 +220,23 @@ const ActionButton: React.FC<IActionButton> = ({ account, actionType, small }) =
} else if (!account.relationship?.blocking && !account.relationship?.muting) {
// Follow & Unfollow
return (
<Button
size='sm'
disabled={blockedBy}
theme={isFollowing ? 'secondary' : 'primary'}
icon={blockedBy ? require('@tabler/icons/ban.svg') : (!isFollowing && require('@tabler/icons/plus.svg'))}
onClick={handleFollow}
>
{isFollowing ? (
intl.formatMessage(messages.unfollow)
) : (
intl.formatMessage(blockedBy ? messages.blocked : messages.follow)
)}
</Button>
// eslint-disable-next-line no-nested-ternary
<Localized id={'account-' + (isFollowing ? 'StatusAction--unfollow' : (blockedBy ? 'Status--block' : 'StatusAction--follow'))}>
<Button
size='sm'
disabled={blockedBy}
theme={isFollowing ? 'secondary' : 'primary'}
icon={blockedBy ? require('@tabler/icons/ban.svg') : (!isFollowing && require('@tabler/icons/plus.svg'))}
onClick={handleFollow}
>
{/* eslint-disable-next-line no-nested-ternary */}
{isFollowing ? (
'Unfollow'
) : (
blockedBy ? 'Blocked' : 'Follow'
)}
</Button>
</Localized>
);
} else if (account.relationship?.blocking) {
// Unblock
Expand Down

0 comments on commit edcf454

Please sign in to comment.