You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
```defaultLang``` | The lang to be used to build default ```strings.xml``` (```/values``` folder)
44
-
```resDirPath``` | The path to the project's ```/res``` folder.
45
84
46
85
After the configuration is done, just run the new ```importPoEditorStrings``` task via Android Studio or command line:
47
86
@@ -55,6 +94,93 @@ This task will:
55
94
* Create and save strings.xml files to ```/values-<lang>``` (or ```/values``` in case of the default lang). It supports
56
95
region specific languages by creating the proper folders (i.e. ```/values-es-rMX```).
57
96
97
+
## Handling multiple flavors and build types
98
+
99
+
Sometimes we might want to import different strings for a given flavor (for example, in white label apps, we could have
100
+
different string definitions depending on the brand where they're used). The plugin supports this kind of apps by providing
101
+
specific configurations via the `poEditorConfig` block.
102
+
103
+
Let's see an example configuration:
104
+
105
+
<detailsopen><summary>Groovy</summary>
106
+
107
+
```groovy
108
+
poEditor {
109
+
// Default config that applies to all flavor/build type configurations.
110
+
// Also executed when calling 'importPoEditorStrings'
111
+
}
112
+
113
+
android {
114
+
// If you have the following flavors...
115
+
flavorDimensions 'type'
116
+
productFlavors {
117
+
free { dimension 'type' }
118
+
paid { dimension 'type' }
119
+
}
120
+
121
+
poEditorConfig {
122
+
free {
123
+
// Configuration for the free flavor, same syntax as the standard 'poEditor' block
124
+
}
125
+
paid {
126
+
// Configuration for the paid flavor, same syntax as the standard 'poEditor' block
127
+
}
128
+
debug {
129
+
// Configuration for the debug build type, same syntax as the standard 'poEditor' block
130
+
}
131
+
release {
132
+
// Configuration for the release build type, same syntax as the standard 'poEditor' block
133
+
}
134
+
}
135
+
}
136
+
```
137
+
138
+
</details>
139
+
140
+
<details><summary>Kotlin</summary>
141
+
142
+
```kt
143
+
poEditor {
144
+
// Default config that applies to all flavor/build type configurations.
145
+
// Also executed when calling 'importPoEditorStrings'
146
+
}
147
+
148
+
android {
149
+
// If you have the following flavors...
150
+
flavorDimensions("type")
151
+
152
+
productFlavors {
153
+
register("free") { setDimension("type") }
154
+
register("paid") { setDimension("type") }
155
+
}
156
+
157
+
poEditorConfig {
158
+
register("free") {
159
+
// Configuration for the free flavor, same syntax as the standard 'poEditor' block
160
+
}
161
+
register("paid") {
162
+
// Configuration for the paid flavor, same syntax as the standard 'poEditor' block
163
+
}
164
+
register("debug") {
165
+
// Configuration for the debug build type, same syntax as the standard 'poEditor' block
166
+
}
167
+
register("release") {
168
+
// Configuration for the release build type, same syntax as the standard 'poEditor' block
169
+
}
170
+
}
171
+
}
172
+
```
173
+
174
+
</details>
175
+
176
+
Each flavor (`free` and `paid`) and build type (`debug` and `release`) will have its own task to import strings for said
177
+
configuration: `importFreePoEditorStrings`, `importPaidPoEditorStrings`, `importDebugPoEditorStrings` and
178
+
`importReleasePoEditorStrings`.
179
+
180
+
Now the `importPoEditorStrings` task will import the main strings configured in the `poEditor` block and also the
181
+
strings for each defined flavor or build type.
182
+
183
+
58
184
## Handling tablet specific strings
59
185
60
186
You can mark some strings as tablet specific strings by adding ```_tablet```suffix to the string key in PoEditor.
@@ -75,7 +201,7 @@ The plug-in will create two `strings.xml` files:
75
201
<stringname="welcome_message">Hey friend how are you doing today, you look great!</string>
76
202
```
77
203
78
-
## Handle placeholders
204
+
## Handling placeholders
79
205
You can add placeholders to your strings. We've defined a placeholder markup to use in PoEditor string definition: it uses a double braces syntax, like this one
0 commit comments