Skip to content

Commit

Permalink
Process InfoPlist.strings in Localazy config. (#2249)
Browse files Browse the repository at this point in the history
Also merge the 2 configs into one using a group to download all strings.
  • Loading branch information
pixlwave authored Dec 15, 2023
1 parent 669141b commit af562ea
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 77 deletions.
4 changes: 4 additions & 0 deletions ElementX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,7 @@
42EEA67A6796BDC2761619C5 /* PaginationIndicatorRoomTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaginationIndicatorRoomTimelineView.swift; sourceTree = "<group>"; };
43A84EE187D0C772E18A4E39 /* VoiceMessageCacheProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceMessageCacheProtocol.swift; sourceTree = "<group>"; };
4481799F455B3DA243BDA2AC /* ShareToMapsAppActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareToMapsAppActivity.swift; sourceTree = "<group>"; };
44C314C00533E2C297796B60 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/InfoPlist.strings; sourceTree = "<group>"; };
450E04B2A976CC4C8CC1807C /* EmoteRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmoteRoomTimelineItem.swift; sourceTree = "<group>"; };
4525E8C0FBDD27D1ACE90952 /* SecureBackupKeyBackupScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackupKeyBackupScreenViewModelProtocol.swift; sourceTree = "<group>"; };
4549FCB53F43DB0B278374BC /* TemplateScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateScreen.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1574,6 +1575,7 @@
9B06663F7858E45882E63471 /* StaticLocationScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StaticLocationScreen.swift; sourceTree = "<group>"; };
9B65A314DF40B6BBF775C2BC /* AnalyticsPromptScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsPromptScreenCoordinator.swift; sourceTree = "<group>"; };
9B663BE498BB39EADC24025D /* SettingsScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsScreenModels.swift; sourceTree = "<group>"; };
9B7D8D3638864B7482E148CC /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/InfoPlist.strings; sourceTree = "<group>"; };
9C4048041C1A6B20CB97FD18 /* TestMeasurementParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestMeasurementParser.swift; sourceTree = "<group>"; };
9C5E81214D27A6B898FC397D /* ElementX.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ElementX.entitlements; sourceTree = "<group>"; };
9C698E30698EC59302A8EEBD /* NavigationStackCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationStackCoordinatorTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6052,6 +6054,8 @@
isa = PBXVariantGroup;
children = (
1215A4FC53D2319E81AE8970 /* en */,
44C314C00533E2C297796B60 /* it */,
9B7D8D3638864B7482E148CC /* ru */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
Expand Down
6 changes: 5 additions & 1 deletion ElementX/Resources/Localizations/en.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
"NSPhotoLibraryUsageDescription" = "The photo library is used to send photos and videos.";
"NSCameraUsageDescription" = "To take pictures or videos and send them as a message Element X needs access to the camera.";
"NSFaceIDUsageDescription" = "Face ID is used to access your app.";
"NSLocationWhenInUseUsageDescription" = "Grant location access so that Element X can share your location.";
"NSMicrophoneUsageDescription" = "To record and send messages with audio, Element X needs to access the microphone.";
"NSPhotoLibraryUsageDescription" = "Allows saving photos and videos to your library.";
5 changes: 5 additions & 0 deletions ElementX/Resources/Localizations/it.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"NSCameraUsageDescription" = "Per scattare foto o video e inviarli come messaggio, Element X deve accedere alla fotocamera.";
"NSFaceIDUsageDescription" = "Face ID viene utilizzato per accedere alla tua app.";
"NSLocationWhenInUseUsageDescription" = "Concedi l'accesso alla posizione in modo che Element X possa condividere la tua posizione.";
"NSMicrophoneUsageDescription" = "Per registrare e inviare messaggi con audio, Element X deve accedere al microfono.";
"NSPhotoLibraryUsageDescription" = "Consente di salvare foto e video nella tua libreria.";
5 changes: 5 additions & 0 deletions ElementX/Resources/Localizations/ru.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"NSCameraUsageDescription" = "Element X требуется доступ к камере, для того чтобы отправлять фото и видно в сообщении";
"NSFaceIDUsageDescription" = "Для доступа к приложению используется Face ID.";
"NSLocationWhenInUseUsageDescription" = "Element X необходимо предоставить разрешения для отправки местоположения.";
"NSMicrophoneUsageDescription" = "%s необходимо предоставить доступ к микрофону, для отправки аудиосообщений.";
"NSPhotoLibraryUsageDescription" = "Разрешить сохранять фотографии и видео в библиотеку.";
4 changes: 2 additions & 2 deletions Tools/Sources/DownloadStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ struct DownloadStrings: ParsableCommand {
}

private func localazyDownload() throws {
let json = allLanguages ? "localazy-all.json" : "localazy-en.json"
try Utilities.zsh("localazy download --config \(json)")
let arguments = allLanguages ? " all" : ""
try Utilities.zsh("localazy download\(arguments)")
}

private func swiftgen() throws {
Expand Down
1 change: 1 addition & 0 deletions changelog.d/2100.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for InfoPlist.strings conversion from Localazy.
34 changes: 0 additions & 34 deletions localazy-all.json

This file was deleted.

40 changes: 0 additions & 40 deletions localazy-en.json

This file was deleted.

94 changes: 94 additions & 0 deletions localazy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"readKey": "a7876306080832595063-aa37154bb3772f6146890fca868d155b2228b492c56c91f67abdcdfb74d6142d",

"conversion": {
"actions": [
{
"type": "ios-strings",
"output": "ElementX/Resources/Localizations/${iosLprojFolder}/Localizable.strings",
"excludeKeys": ["REGEX:.*_android"],
"conditions": [
"equals: ${languageCode}, en | equals: ${file}, content.json"
],
"filterPlurals": true,
"replacements": {
"%s": "%@",
"$s": "$@"
},
"params": {
"flatten_keys": "underscore"
}
},
{
"type": "ios-stringsdict",
"output": "ElementX/Resources/Localizations/${iosLprojFolder}/Localizable.stringsdict",
"excludeKeys": ["REGEX:.*_android"],
"conditions": [
"equals: ${languageCode}, en | equals: ${file}, content.json"
],
"replacements": {
"%s": "%@",
"$s": "$@"
},
"params": {
"variable": "COUNT",
"flatten_keys": "underscore"
}
},
{
"type": "ios-strings",
"changeExtension": "strings",
"output": "ElementX/Resources/Localizations/${iosLprojFolder}/${file}",
"conditions": [
"equals: ${languageCode}, en | equals: ${file}, InfoPlist.json"
]
},



{
"group": "all",
"type": "ios-strings",
"output": "ElementX/Resources/Localizations/${iosLprojFolder}/Localizable.strings",
"excludeKeys": ["REGEX:.*_android"],
"conditions": [
"!equals: ${languageCode}, en | equals: ${file}, content.json"
],
"filterPlurals": true,
"replacements": {
"%s": "%@",
"$s": "$@"
},
"params": {
"flatten_keys": "underscore"
}
},
{
"group": "all",
"type": "ios-stringsdict",
"output": "ElementX/Resources/Localizations/${iosLprojFolder}/Localizable.stringsdict",
"excludeKeys": ["REGEX:.*_android"],
"conditions": [
"!equals: ${languageCode}, en | equals: ${file}, content.json"
],
"replacements": {
"%s": "%@",
"$s": "$@"
},
"params": {
"variable": "COUNT",
"flatten_keys": "underscore"
}
},
{
"group": "all",
"type": "ios-strings",
"changeExtension": "strings",
"output": "ElementX/Resources/Localizations/${iosLprojFolder}/${file}",
"conditions": [
"!equals: ${languageCode}, en | equals: ${file}, InfoPlist.json"
]
}
]
}
}

0 comments on commit af562ea

Please sign in to comment.