Translate some missing strings via global i18n instance (#5740)

This commit is contained in:
Samuel Newman
2024-10-14 18:19:30 +03:00
committed by GitHub
parent db7b875c52
commit a445489b53
3 changed files with 13 additions and 9 deletions
+5 -3
View File
@@ -3,8 +3,10 @@ import {
launchImageLibraryAsync, launchImageLibraryAsync,
MediaTypeOptions, MediaTypeOptions,
} from 'expo-image-picker' } from 'expo-image-picker'
// TODO: replace global i18n instance with one returned from useLingui -sfn
import {t} from '@lingui/macro'
import * as Toast from 'view/com/util/Toast' import * as Toast from '#/view/com/util/Toast'
import {getDataUriSize} from './util' import {getDataUriSize} from './util'
export async function openPicker(opts?: ImagePickerOptions) { export async function openPicker(opts?: ImagePickerOptions) {
@@ -17,14 +19,14 @@ export async function openPicker(opts?: ImagePickerOptions) {
}) })
if (response.assets && response.assets.length > 4) { if (response.assets && response.assets.length > 4) {
Toast.show('You may only select up to 4 images', 'exclamation-circle') Toast.show(t`You may only select up to 4 images`, 'exclamation-circle')
} }
return (response.assets ?? []) return (response.assets ?? [])
.slice(0, 4) .slice(0, 4)
.filter(asset => { .filter(asset => {
if (asset.mimeType?.startsWith('image/')) return true if (asset.mimeType?.startsWith('image/')) return true
Toast.show('Only image files are supported', 'exclamation-circle') Toast.show(t`Only image files are supported`, 'exclamation-circle')
return false return false
}) })
.map(image => ({ .map(image => ({
+4 -2
View File
@@ -1,8 +1,10 @@
import {Share} from 'react-native' import {Share} from 'react-native'
// import * as Sharing from 'expo-sharing' // import * as Sharing from 'expo-sharing'
import {setStringAsync} from 'expo-clipboard' import {setStringAsync} from 'expo-clipboard'
// TODO: replace global i18n instance with one returned from useLingui -sfn
import {t} from '@lingui/macro'
import {isAndroid, isIOS} from 'platform/detection' import {isAndroid, isIOS} from '#/platform/detection'
import * as Toast from '#/view/com/util/Toast' import * as Toast from '#/view/com/util/Toast'
/** /**
@@ -20,6 +22,6 @@ export async function shareUrl(url: string) {
// React Native Share is not supported by web. Web Share API // React Native Share is not supported by web. Web Share API
// has increasing but not full support, so default to clipboard // has increasing but not full support, so default to clipboard
setStringAsync(url) setStringAsync(url)
Toast.show('Copied to clipboard', 'clipboard-check') Toast.show(t`Copied to clipboard`, 'clipboard-check')
} }
} }
+4 -4
View File
@@ -268,8 +268,8 @@ let PostDropdownBtn = ({
item: postUri, item: postUri,
feedContext: postFeedContext, feedContext: postFeedContext,
}) })
Toast.show('Feedback sent!') Toast.show(_(msg`Feedback sent!`))
}, [feedFeedback, postUri, postFeedContext]) }, [feedFeedback, postUri, postFeedContext, _])
const onPressShowLess = React.useCallback(() => { const onPressShowLess = React.useCallback(() => {
feedFeedback.sendInteraction({ feedFeedback.sendInteraction({
@@ -277,8 +277,8 @@ let PostDropdownBtn = ({
item: postUri, item: postUri,
feedContext: postFeedContext, feedContext: postFeedContext,
}) })
Toast.show('Feedback sent!') Toast.show(_(msg`Feedback sent!`))
}, [feedFeedback, postUri, postFeedContext]) }, [feedFeedback, postUri, postFeedContext, _])
const onSelectChatToShareTo = React.useCallback( const onSelectChatToShareTo = React.useCallback(
(conversation: string) => { (conversation: string) => {