Skip to content

Commit

Permalink
🌐 为IOS加入了多语言的支持
Browse files Browse the repository at this point in the history
英文、简体中文、繁体中文
  • Loading branch information
Gaubee committed Jan 10, 2025
1 parent db89575 commit 78263e4
Show file tree
Hide file tree
Showing 12 changed files with 230 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
/* Begin PBXBuildFile section */
1A0D794E6805F75B088C0939 /* DwebBrowserApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A0D7C84CC71A12D5FCBBF78 /* DwebBrowserApp.swift */; };
3228A1152C885AD700D52353 /* EdgeAnimationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3228A1142C885AD700D52353 /* EdgeAnimationView.swift */; };
3D0947422D31325300CE8505 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3D0947402D31325300CE8505 /* InfoPlist.strings */; };
3D0947452D31325300CE8505 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3D0947432D31325300CE8505 /* Localizable.strings */; };
48001B9F2B8ED4CB00F47669 /* DwebBrowserUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48001B9E2B8ED4CB00F47669 /* DwebBrowserUITests.swift */; };
48001BA12B8ED4CB00F47669 /* DwebBrowserUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48001BA02B8ED4CB00F47669 /* DwebBrowserUITestsLaunchTests.swift */; };
48001BAA2B8F1ADE00F47669 /* DwebUITestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48001BA92B8F1ADE00F47669 /* DwebUITestCase.swift */; };
Expand Down Expand Up @@ -73,6 +75,12 @@
1A0D7C84CC71A12D5FCBBF78 /* DwebBrowserApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DwebBrowserApp.swift; sourceTree = "<group>"; };
3228A1142C885AD700D52353 /* EdgeAnimationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EdgeAnimationView.swift; sourceTree = "<group>"; };
3D037B8C2C4392FB00AF8A00 /* DwebBrowser.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DwebBrowser.entitlements; sourceTree = "<group>"; };
3D0947412D31325300CE8505 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
3D0947442D31325300CE8505 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
3D0947462D31325A00CE8505 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
3D0947472D31325A00CE8505 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
3D0947482D31326000CE8505 /* zh-HK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-HK"; path = "zh-HK.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
3D0947492D31326000CE8505 /* zh-HK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-HK"; path = "zh-HK.lproj/Localizable.strings"; sourceTree = "<group>"; };
48001B9C2B8ED4CB00F47669 /* DwebBrowserUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DwebBrowserUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
48001B9E2B8ED4CB00F47669 /* DwebBrowserUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DwebBrowserUITests.swift; sourceTree = "<group>"; };
48001BA02B8ED4CB00F47669 /* DwebBrowserUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DwebBrowserUITestsLaunchTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -256,6 +264,8 @@
4819C2EB2B4FED53001BB45D /* Tools */,
4850503F2B146B5700080723 /* Preview Content */,
7555FF8C242A565B00829871 /* Info.plist */,
3D0947432D31325300CE8505 /* Localizable.strings */,
3D0947402D31325300CE8505 /* InfoPlist.strings */,
48334DC82B50CFFF00399FFF /* Assets.xcassets */,
);
path = DwebBrowser;
Expand Down Expand Up @@ -362,6 +372,9 @@
knownRegions = (
en,
Base,
"zh-Hans",
"zh-Hant",
"zh-HK",
);
mainGroup = 7555FF72242A565900829871;
productRefGroup = 7555FF7C242A565900829871 /* Products */;
Expand Down Expand Up @@ -394,7 +407,9 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3D0947452D31325300CE8505 /* Localizable.strings in Resources */,
48334DC92B50CFFF00399FFF /* Assets.xcassets in Resources */,
3D0947422D31325300CE8505 /* InfoPlist.strings in Resources */,
481488662B970A3E005D7D00 /* LinkSort.order in Resources */,
485050412B146B5700080723 /* Preview Assets.xcassets in Resources */,
);
Expand Down Expand Up @@ -477,6 +492,29 @@
};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
3D0947402D31325300CE8505 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
3D0947412D31325300CE8505 /* zh-Hans */,
3D0947462D31325A00CE8505 /* zh-Hant */,
3D0947482D31326000CE8505 /* zh-HK */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
3D0947432D31325300CE8505 /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
3D0947442D31325300CE8505 /* zh-Hans */,
3D0947472D31325A00CE8505 /* zh-Hant */,
3D0947492D31326000CE8505 /* zh-HK */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
48001BA42B8ED4CB00F47669 /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down
21 changes: 14 additions & 7 deletions next/kmp/app/iosApp/DwebBrowser/DwebBrowser/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,26 @@
<true/>
</dict>
<key>NSCameraUsageDescription</key>
<string>用于支持扫一扫等功能</string>
<string>Please allow "Dweb Browser" to use your camera, for supports features such as Barcode scanning, photo and video shooting, and real-time video communication.
</string>
<key>NSFaceIDUsageDescription</key>
<string>Access requires authentication</string>
<string>Please allow "Dweb Browser" to use your Face ID, for supports features such as face recognition and identity authentication
</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Please allow "DwebBrowser" to use your location</string>
<string>Please allow "Dweb Browser" to use your location. for supports features such geolocation and location sharing.
</string>
<key>NSLocationUsageDescription</key>
<string>Please allow "DwebBrowser" to use your location</string>
<string>Please allow "Dweb Browser" to use your location. for supports features such geolocation and location sharing.
</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Please allow "DwebBrowser" to use your location</string>
<string>Please allow "Dweb Browser" to use your location. for supports features such geolocation and location sharing.
</string>
<key>NSMicrophoneUsageDescription</key>
<string>Please allow "DwebBrowser" to use your microphone</string>
<string>Please allow "Dweb Browser" to use your microphone, for supports features such as voice recording, and real-time voice communication.
</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>用于保存图片到相册</string>
<string>Please allow "Dweb Browser" to use your Photo Library. for supports features such save photos.
</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ struct UpgradleTipModifier: ViewModifier {
}, set: {
versionMgr.needUpdate = $0
})) {
Alert(title: Text("更新提示"),
message: Text("有新版本可用,请您前往App Store更新。"),
Alert(title: Text("Update Notification"),
message: Text("A new version is available. Please go to the App Store to update."),
primaryButton: .cancel(),
secondaryButton: .default(Text("前往更新"), action: {
secondaryButton: .default(Text("Go to App Store"), action: {
UIApplication.shared.open(URL(string: AppVersionMgr.appStoreURL)!, options: [:], completionHandler: nil)
}))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Bundle display name */
"CFBundleDisplayName" = "自由穿梭";

/* Bundle name */
"CFBundleName" = "DwebBrowser";

/* Privacy - Camera Usage Description */
"NSCameraUsageDescription" = "請允許「自由穿梭」使用您的相機,用於「掃碼」、「拍攝」、「視訊通話」等功能。";

/* Privacy - Face ID Usage Description */
"NSFaceIDUsageDescription" = "請允許「自由穿梭」使用您的面容ID,用於「人臉辨識」、「身分認證」等功能。";

/* Privacy - Location Always and When In Use Usage Description */
"NSLocationAlwaysAndWhenInUseUsageDescription" = "請允許「自由穿梭」使用您的位置資訊。用於「地理定位」、「位置共享」等功能。";

/* Privacy - Location Usage Description */
"NSLocationUsageDescription" = "請允許「自由穿梭」使用您的位置資訊。用於「地理定位」、「位置共享」等功能。";

/* Privacy - Location When In Use Usage Description */
"NSLocationWhenInUseUsageDescription" = "請允許「自由穿梭」使用您的位置資訊。用於「地理定位」、「位置共享」等功能。";

/* Privacy - Microphone Usage Description */
"NSMicrophoneUsageDescription" = "請允許“自由穿梭”使用您的麥克風。用於「音訊錄製」、「語音通話」等功能。";

/* Privacy - Photo Library Usage Description */
"NSPhotoLibraryUsageDescription" = "請允許「自由穿梭」使用您的相簿。用於「儲存照片」等功能。";

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* No comment provided by engineer. */
"A new version is available. Please go to the App Store to update." = "有新版本可用,請您前往App Store更新。";

/* No comment provided by engineer. */
"Go to App Store" = "前往更新";

/* No comment provided by engineer. */
"Loading..." = "載入中…";

/* No comment provided by engineer. */
"Update Notification" = "更新提示";

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Bundle display name */
"CFBundleDisplayName" = "自由穿梭";

/* Bundle name */
"CFBundleName" = "DwebBrowser";

/* Privacy - Camera Usage Description */
"NSCameraUsageDescription" = "请允许“自由穿梭”使用您的相机,用于“扫码”、“拍摄”、“视频通话”等功能。\n";

/* Privacy - Face ID Usage Description */
"NSFaceIDUsageDescription" = "请允许“自由穿梭”使用您的面容ID,用于“人脸识别”、“身份认证”等功能。";

/* Privacy - Location Always and When In Use Usage Description */
"NSLocationAlwaysAndWhenInUseUsageDescription" = "请允许“自由穿梭”使用您的位置信息。用于“地理定位”、“位置共享”等功能。";

/* Privacy - Location Usage Description */
"NSLocationUsageDescription" = "请允许“自由穿梭”使用您的位置信息。用于“地理定位”、“位置共享”等功能。";

/* Privacy - Location When In Use Usage Description */
"NSLocationWhenInUseUsageDescription" = "请允许“自由穿梭”使用您的位置信息。用于“地理定位”、“位置共享”等功能。";

/* Privacy - Microphone Usage Description */
"NSMicrophoneUsageDescription" = "请允许“自由穿梭”使用您的麦克风。用于“音频录制”、“语音通话”等功能。";

/* Privacy - Photo Library Usage Description */
"NSPhotoLibraryUsageDescription" = "请允许“自由穿梭”使用您的相册。用于“保存照片”等功能。";

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* No comment provided by engineer. */
"A new version is available. Please go to the App Store to update." = "有新版本可用,请您前往App Store更新。";

/* No comment provided by engineer. */
"Go to App Store" = "前往更新";

/* No comment provided by engineer. */
"Loading..." = "加载中…";

/* No comment provided by engineer. */
"Update Notification" = "更新提示";

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Bundle display name */
"CFBundleDisplayName" = "更新提示";

/* Bundle name */
"CFBundleName" = "DwebBrowser";

/* Privacy - Camera Usage Description */
"NSCameraUsageDescription" = "請允許「自由穿梭」使用您的相機,用於「掃碼」、「拍攝」、「視訊通話」等功能。";

/* Privacy - Face ID Usage Description */
"NSFaceIDUsageDescription" = "請允許「自由穿梭」使用您的面容ID,用於「人臉辨識」、「身分認證」等功能。";

/* Privacy - Location Always and When In Use Usage Description */
"NSLocationAlwaysAndWhenInUseUsageDescription" = "請允許「自由穿梭」使用您的位置資訊。用於「地理定位」、「位置共享」等功能。";

/* Privacy - Location Usage Description */
"NSLocationUsageDescription" = "請允許「自由穿梭」使用您的位置資訊。用於「地理定位」、「位置共享」等功能。";

/* Privacy - Location When In Use Usage Description */
"NSLocationWhenInUseUsageDescription" = "請允許「自由穿梭」使用您的位置資訊。用於「地理定位」、「位置共享」等功能。";

/* Privacy - Microphone Usage Description */
"NSMicrophoneUsageDescription" = "請允許“自由穿梭”使用您的麥克風。用於「音訊錄製」、「語音通話」等功能。";

/* Privacy - Photo Library Usage Description */
"NSPhotoLibraryUsageDescription" = "請允許「自由穿梭」使用您的相簿。用於「儲存照片」等功能。";

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* No comment provided by engineer. */
"A new version is available. Please go to the App Store to update." = "有新版本可用,請您前往App Store更新。";

/* No comment provided by engineer. */
"Go to App Store" = "前往更新";

/* No comment provided by engineer. */
"Loading..." = "載入中…";

/* No comment provided by engineer. */
"Update Notification" = "更新提示";

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -37,7 +38,6 @@ import org.dweb_browser.browser.download.model.DownloadTask
import org.dweb_browser.browser.web.data.formatToStickyName
import org.dweb_browser.core.module.MicroModule
import org.dweb_browser.core.std.file.ext.blobFetchHook
import org.dweb_browser.helper.compose.HorizontalDivider
import org.dweb_browser.helper.compose.clickableWithNoEffect
import org.dweb_browser.helper.formatTimestampByMilliseconds
import org.dweb_browser.helper.platform.theme.LocalColorful
Expand Down Expand Up @@ -75,14 +75,11 @@ private fun DownloadTask.AppHeadInfo(modifier: Modifier = Modifier) {
val scope = rememberCoroutineScope()
val urlCopySuccess = DownloadI18n.url_copy_success()
Text(
url,
modifier = modifier.clickable {
url, modifier = modifier.clickable {
clipboardManager.setText(AnnotatedString(url))
scope.launch { mm.showToast(urlCopySuccess) }
},
style = style.merge(
color = LocalColorful.current.Blue.current,
textDecoration = TextDecoration.Underline
}, style = style.merge(
color = LocalColorful.current.Blue.current, textDecoration = TextDecoration.Underline
)
)
}
Expand All @@ -103,34 +100,32 @@ private fun DownloadTask.AppHeadInfo(modifier: Modifier = Modifier) {
title = DownloadI18n.unzip_label_originMmid(), content = originMmid
)

else ->
TableRow(
title = DownloadI18n.unzip_label_originMmid(),
) { modifier, style ->
Row(
modifier,
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.Top
else -> TableRow(
title = DownloadI18n.unzip_label_originMmid(),
) { modifier, style ->
Row(
modifier,
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.Top
) {
AppLogo.fromResources(microModule.icons, fetchHook = mm.blobFetchHook).toDeskAppIcon()
.Render(Modifier.size(32.dp))
Column(
Modifier.padding(start = 4.dp), verticalArrangement = Arrangement.spacedBy(2.dp)
) {
AppLogo.fromResources(microModule.icons, fetchHook = mm.blobFetchHook).toDeskAppIcon()
.Render(Modifier.size(32.dp))
Column(
Modifier.padding(start = 4.dp),
verticalArrangement = Arrangement.spacedBy(2.dp)
) {
Text(
microModule.name,
style = MaterialTheme.typography.bodySmall,
fontWeight = FontWeight.Bold
)
Text(
originMmid,
style = MaterialTheme.typography.bodySmall.run { copy(fontSize = fontSize * 0.8f) },
fontStyle = FontStyle.Italic
)
}
Text(
microModule.name,
style = MaterialTheme.typography.bodySmall,
fontWeight = FontWeight.Bold
)
Text(
originMmid,
style = MaterialTheme.typography.bodySmall.run { copy(fontSize = fontSize * 0.8f) },
fontStyle = FontStyle.Italic
)
}
}
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SegmentedButton
Expand All @@ -24,36 +25,29 @@ import org.dweb_browser.browser.download.DownloadController
import org.dweb_browser.browser.download.model.DownloadListTabs
import org.dweb_browser.browser.download.model.DownloadState
import org.dweb_browser.browser.download.model.DownloadTask
import org.dweb_browser.helper.compose.HorizontalDivider
import org.dweb_browser.helper.compose.NoDataRender

@Composable
fun DownloadController.DownloadList(
modifier: Modifier,
downloadClick: (DownloadTask) -> Unit
downloadClick: (DownloadTask) -> Unit,
) {
Column(
modifier = modifier
.fillMaxSize()
.background(MaterialTheme.colorScheme.background)
modifier = modifier.fillMaxSize().background(MaterialTheme.colorScheme.background)
) {
SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp)) {
downloadListModel.tabItems.forEachIndexed { index, downloadTab ->
SegmentedButton(
selected = index == downloadListModel.tabIndex,
SegmentedButton(selected = index == downloadListModel.tabIndex,
onClick = { downloadListModel.tabIndex = index },
shape = SegmentedButtonDefaults.itemShape(
index = index,
count = downloadListModel.tabItems.size
index = index, count = downloadListModel.tabItems.size
),
icon = {
Icon(
imageVector = downloadTab.icon,
contentDescription = downloadTab.title()
imageVector = downloadTab.icon, contentDescription = downloadTab.title()
)
},
label = { Text(text = downloadTab.title()) }
)
label = { Text(text = downloadTab.title()) })
}
}
val downloadTab = downloadListModel.tabItems[downloadListModel.tabIndex]
Expand Down
Loading

0 comments on commit 78263e4

Please sign in to comment.