Create baseAction for shared values.
This commit is contained in:
parent
830946e0de
commit
e316fcef04
1 changed files with 10 additions and 15 deletions
|
|
@ -20,9 +20,12 @@ regexToAlwaysExclude = [
|
||||||
".*_ios"
|
".*_ios"
|
||||||
]
|
]
|
||||||
|
|
||||||
# Replacement done in all string values
|
baseAction = {
|
||||||
replacements = {
|
"type": "android",
|
||||||
"...": "…"
|
# Replacement done in all string values
|
||||||
|
"replacements": {
|
||||||
|
"...": "…"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Store all regex specific to module, to eclude the corresponding keyx from the common string module
|
# Store all regex specific to module, to eclude the corresponding keyx from the common string module
|
||||||
|
|
@ -33,12 +36,10 @@ allActions = []
|
||||||
# Iterating on the config
|
# Iterating on the config
|
||||||
for entry in config["modules"]:
|
for entry in config["modules"]:
|
||||||
# Create action for the default language
|
# Create action for the default language
|
||||||
action = {
|
action = baseAction | {
|
||||||
"type": "android",
|
|
||||||
"output": convertModuleToPath(entry["name"]) + "/src/main/res/values/localazy.xml",
|
"output": convertModuleToPath(entry["name"]) + "/src/main/res/values/localazy.xml",
|
||||||
"includeKeys": list(map(lambda i: "REGEX:" + i, entry["includeRegex"])),
|
"includeKeys": list(map(lambda i: "REGEX:" + i, entry["includeRegex"])),
|
||||||
"excludeKeys": list(map(lambda i: "REGEX:" + i, regexToAlwaysExclude)),
|
"excludeKeys": list(map(lambda i: "REGEX:" + i, regexToAlwaysExclude)),
|
||||||
"replacements": replacements,
|
|
||||||
"conditions": [
|
"conditions": [
|
||||||
"equals: ${languageCode}, en"
|
"equals: ${languageCode}, en"
|
||||||
]
|
]
|
||||||
|
|
@ -47,12 +48,10 @@ for entry in config["modules"]:
|
||||||
allActions.append(action)
|
allActions.append(action)
|
||||||
# Create action for the translations
|
# Create action for the translations
|
||||||
if allFiles:
|
if allFiles:
|
||||||
actionTranslation = {
|
actionTranslation = baseAction | {
|
||||||
"type": "android",
|
|
||||||
"output": convertModuleToPath(entry["name"]) + "/src/main/res/values-${langAndroidResNoScript}/translations.xml",
|
"output": convertModuleToPath(entry["name"]) + "/src/main/res/values-${langAndroidResNoScript}/translations.xml",
|
||||||
"includeKeys": list(map(lambda i: "REGEX:" + i, entry["includeRegex"])),
|
"includeKeys": list(map(lambda i: "REGEX:" + i, entry["includeRegex"])),
|
||||||
"excludeKeys": list(map(lambda i: "REGEX:" + i, regexToAlwaysExclude)),
|
"excludeKeys": list(map(lambda i: "REGEX:" + i, regexToAlwaysExclude)),
|
||||||
"replacements": replacements,
|
|
||||||
"conditions": [
|
"conditions": [
|
||||||
"!equals: ${languageCode}, en"
|
"!equals: ${languageCode}, en"
|
||||||
]
|
]
|
||||||
|
|
@ -61,11 +60,9 @@ for entry in config["modules"]:
|
||||||
allRegexToExcludeFromMainModule.extend(entry["includeRegex"])
|
allRegexToExcludeFromMainModule.extend(entry["includeRegex"])
|
||||||
|
|
||||||
# Append configuration for the main string module: default language
|
# Append configuration for the main string module: default language
|
||||||
mainAction = {
|
mainAction = baseAction | {
|
||||||
"type": "android",
|
|
||||||
"output": "libraries/ui-strings/src/main/res/values/localazy.xml",
|
"output": "libraries/ui-strings/src/main/res/values/localazy.xml",
|
||||||
"excludeKeys": list(map(lambda i: "REGEX:" + i, allRegexToExcludeFromMainModule + regexToAlwaysExclude)),
|
"excludeKeys": list(map(lambda i: "REGEX:" + i, allRegexToExcludeFromMainModule + regexToAlwaysExclude)),
|
||||||
"replacements": replacements,
|
|
||||||
"conditions": [
|
"conditions": [
|
||||||
"equals: ${languageCode}, en"
|
"equals: ${languageCode}, en"
|
||||||
]
|
]
|
||||||
|
|
@ -75,11 +72,9 @@ allActions.append(mainAction)
|
||||||
|
|
||||||
if allFiles:
|
if allFiles:
|
||||||
# Append configuration for the main string module: translations
|
# Append configuration for the main string module: translations
|
||||||
mainActionTranslation = {
|
mainActionTranslation = baseAction | {
|
||||||
"type": "android",
|
|
||||||
"output": "libraries/ui-strings/src/main/res/values-${langAndroidResNoScript}/translations.xml",
|
"output": "libraries/ui-strings/src/main/res/values-${langAndroidResNoScript}/translations.xml",
|
||||||
"excludeKeys": list(map(lambda i: "REGEX:" + i, allRegexToExcludeFromMainModule + regexToAlwaysExclude)),
|
"excludeKeys": list(map(lambda i: "REGEX:" + i, allRegexToExcludeFromMainModule + regexToAlwaysExclude)),
|
||||||
"replacements": replacements,
|
|
||||||
"conditions": [
|
"conditions": [
|
||||||
"!equals: ${languageCode}, en"
|
"!equals: ${languageCode}, en"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue