Internationalize more strings (#2440)

Co-authored-by: Ansh <anshnanda10@gmail.com>
This commit is contained in:
Stanislas Signoud 2024-01-09 23:37:15 +01:00 committed by GitHub
parent aeeacd10d3
commit 008893b911
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
108 changed files with 925 additions and 558 deletions

View file

@ -65,7 +65,6 @@ export function Component({
return 'app.bsky.graph.defs#curatelist'
}, [list, purpose])
const isCurateList = activePurpose === 'app.bsky.graph.defs#curatelist'
const purposeLabel = isCurateList ? 'User' : 'Moderation'
const [isProcessing, setProcessing] = useState<boolean>(false)
const [name, setName] = useState<string>(list?.name || '')
@ -106,7 +105,7 @@ export function Component({
}
const nameTrimmed = name.trim()
if (!nameTrimmed) {
setError('Name is required')
setError(_(msg`Name is required`))
return
}
setProcessing(true)
@ -121,7 +120,11 @@ export function Component({
description: description.trim(),
avatar: newAvatar,
})
Toast.show(`${purposeLabel} list updated`)
Toast.show(
isCurateList
? _(msg`User list updated`)
: _(msg`Moderation list updated`),
)
onSave?.(list.uri)
} else {
const res = await listCreateMutation.mutateAsync({
@ -130,14 +133,20 @@ export function Component({
description,
avatar: newAvatar,
})
Toast.show(`${purposeLabel} list created`)
Toast.show(
isCurateList
? _(msg`User list created`)
: _(msg`Moderation list created`),
)
onSave?.(res.uri)
}
closeModal()
} catch (e: any) {
if (isNetworkError(e)) {
setError(
'Failed to create the list. Check your internet connection and try again.',
_(
msg`Failed to create the list. Check your internet connection and try again.`,
),
)
} else {
setError(cleanError(e))
@ -153,13 +162,13 @@ export function Component({
closeModal,
activePurpose,
isCurateList,
purposeLabel,
name,
description,
newAvatar,
list,
listMetadataMutation,
listCreateMutation,
_,
])
return (
@ -174,7 +183,17 @@ export function Component({
testID="createOrEditListModal">
<Text style={[styles.title, pal.text]}>
<Trans>
{list ? 'Edit' : 'New'} {purposeLabel} List
{isCurateList ? (
list ? (
<Trans>Edit User List</Trans>
) : (
<Trans>New User List</Trans>
)
) : list ? (
<Trans>Edit Moderation List</Trans>
) : (
<Trans>New Moderation List</Trans>
)}
</Trans>
</Text>
{error !== '' && (
@ -202,7 +221,9 @@ export function Component({
testID="editNameInput"
style={[styles.textInput, pal.border, pal.text]}
placeholder={
isCurateList ? 'e.g. Great Posters' : 'e.g. Spammers'
isCurateList
? _(msg`e.g. Great Posters`)
: _(msg`e.g. Spammers`)
}
placeholderTextColor={colors.gray4}
value={name}
@ -222,8 +243,8 @@ export function Component({
style={[styles.textArea, pal.border, pal.text]}
placeholder={
isCurateList
? 'e.g. The posters who never miss.'
: 'e.g. Users that repeatedly reply with ads.'
? _(msg`e.g. The posters who never miss.`)
: _(msg`e.g. Users that repeatedly reply with ads.`)
}
placeholderTextColor={colors.gray4}
keyboardAppearance={theme.colorScheme}
@ -254,7 +275,7 @@ export function Component({
end={{x: 1, y: 1}}
style={[styles.btn]}>
<Text style={[s.white, s.bold]}>
<Trans>Save</Trans>
<Trans context="action">Save</Trans>
</Text>
</LinearGradient>
</TouchableOpacity>
@ -269,7 +290,7 @@ export function Component({
onAccessibilityEscape={onPressCancel}>
<View style={[styles.btn]}>
<Text style={[s.black, s.bold, pal.text]}>
<Trans>Cancel</Trans>
<Trans context="action">Cancel</Trans>
</Text>
</View>
</TouchableOpacity>