Skip to content

Commit

Permalink
Support InfoPlist.strings in Localazy config.
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 committed Dec 14, 2023
1 parent 669141b commit 9224d41
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 76 deletions.
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
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 9224d41

Please sign in to comment.