mirror of
https://github.com/tooot-app/app
synced 2025-01-02 12:47:13 +01:00
Use system's preferred language for iOS
This commit is contained in:
parent
757e5bb52f
commit
e605a35e3a
2
ios/ja.lproj/InfoPlist.strings
Normal file
2
ios/ja.lproj/InfoPlist.strings
Normal file
@ -0,0 +1,2 @@
|
||||
"NSPhotoLibraryAddUsageDescription" = "tooot が画像をカメラロールに保存できるようにします";
|
||||
"NSPhotoLibraryUsageDescription" = "tooot が画像をカメラロールに保存できるようにします";
|
@ -81,6 +81,7 @@
|
||||
E69EBACC28DF28420057EDEC /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
E69EBACD28DF284D0057EDEC /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
|
||||
E69EBACE28DF28560057EDEC /* vi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = vi; path = vi.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
E6C8B26628F5F9FC0062CF2E /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
|
||||
ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
@ -287,6 +288,7 @@
|
||||
ko,
|
||||
"pt-BR",
|
||||
vi,
|
||||
ja,
|
||||
);
|
||||
mainGroup = 83CBB9F61A601CBA00E9B192;
|
||||
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
|
||||
@ -338,7 +340,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "set -e\nexport SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\nSENTRY_CLI_PATH=\"../node_modules/@sentry/cli/bin/sentry-cli\"\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$SENTRY_CLI_PATH react-native xcode $REACT_NATIVE_XCODE\\\"\"";
|
||||
shellScript = "set -e\nexport SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\nSENTRY_CLI_PATH=\"../node_modules/@sentry/cli/bin/sentry-cli\"\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$SENTRY_CLI_PATH react-native xcode $REACT_NATIVE_XCODE\\\"\"\n";
|
||||
};
|
||||
08A4A3CD28434E44B6B9DE2E /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
@ -511,6 +513,7 @@
|
||||
E69EBACC28DF28420057EDEC /* ko */,
|
||||
E69EBACD28DF284D0057EDEC /* pt-BR */,
|
||||
E69EBACE28DF28560057EDEC /* vi */,
|
||||
E6C8B26628F5F9FC0062CF2E /* ja */,
|
||||
);
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
|
11
src/App.tsx
11
src/App.tsx
@ -14,6 +14,7 @@ import * as Sentry from '@sentry/react-native'
|
||||
import AccessibilityManager from '@utils/accessibility/AccessibilityManager'
|
||||
import { changeLanguage, getSettingsLanguage } from '@utils/slices/settingsSlice'
|
||||
import ThemeManager from '@utils/styles/ThemeManager'
|
||||
import * as Localization from 'expo-localization'
|
||||
import * as SplashScreen from 'expo-splash-screen'
|
||||
import React, { useCallback, useEffect, useState } from 'react'
|
||||
import { LogBox, Platform } from 'react-native'
|
||||
@ -81,9 +82,15 @@ const App: React.FC = () => {
|
||||
log('log', 'App', 'bootstrapped')
|
||||
if (bootstrapped) {
|
||||
log('log', 'App', 'loading actual app :)')
|
||||
const language = getSettingsLanguage(store.getState())
|
||||
log('log', 'App', `Locale: ${Localization.locale}`)
|
||||
const language =
|
||||
Platform.OS === 'ios'
|
||||
? Localization.locale
|
||||
: getSettingsLanguage(store.getState())
|
||||
if (!language) {
|
||||
store.dispatch(changeLanguage('en'))
|
||||
if (Platform.OS !== 'ios') {
|
||||
store.dispatch(changeLanguage('en'))
|
||||
}
|
||||
i18n.changeLanguage('en')
|
||||
} else {
|
||||
i18n.changeLanguage(language)
|
||||
|
@ -16,8 +16,10 @@ import {
|
||||
getSettingsStaticEmoji,
|
||||
changeStaticEmoji
|
||||
} from '@utils/slices/settingsSlice'
|
||||
import * as Localization from 'expo-localization'
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Linking, Platform } from 'react-native'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { mapFontsizeToName } from '../SettingsFontsize'
|
||||
|
||||
@ -37,18 +39,20 @@ const SettingsApp: React.FC = () => {
|
||||
<MenuContainer>
|
||||
<MenuRow
|
||||
title={t('me.settings.fontsize.heading')}
|
||||
content={t(
|
||||
`me.settings.fontsize.content.${mapFontsizeToName(settingsFontsize)}`
|
||||
)}
|
||||
content={t(`me.settings.fontsize.content.${mapFontsizeToName(settingsFontsize)}`)}
|
||||
iconBack='ChevronRight'
|
||||
onPress={() => navigation.navigate('Tab-Me-Settings-Fontsize')}
|
||||
/>
|
||||
<MenuRow
|
||||
title={t('me.settings.language.heading')}
|
||||
// @ts-ignore
|
||||
content={LOCALES[i18n.language]}
|
||||
content={LOCALES[Platform.OS === 'ios' ? Localization.locale : i18n.language]}
|
||||
iconBack='ChevronRight'
|
||||
onPress={() => navigation.navigate('Tab-Me-Settings-Language')}
|
||||
onPress={() =>
|
||||
Platform.OS === 'ios'
|
||||
? Linking.openSettings()
|
||||
: navigation.navigate('Tab-Me-Settings-Language')
|
||||
}
|
||||
/>
|
||||
<MenuRow
|
||||
title={t('me.settings.theme.heading')}
|
||||
|
Loading…
Reference in New Issue
Block a user