@@ -151,18 +151,18 @@ def start_localize_ios(source_path, all_writes, lang_keys):
151
151
def start_localize_android (source_path , all_writes , lang_keys ):
152
152
allwrites = all_writes
153
153
154
+ [fwrite .write ('<?xml version="1.0" encoding="utf-8"?>\n ' ) for fwrite in allwrites ]
155
+ [fwrite .write ('<resources>' ) for fwrite in allwrites ]
156
+
154
157
for dirname , dirnames , filenames in os .walk (source_path ):
155
- [fwrite .write ('<?xml version="1.0" encoding="utf-8"?>\n ' ) for fwrite in allwrites ]
156
- [fwrite .write ('<resources>' ) for fwrite in allwrites ]
157
-
158
158
for f in filenames :
159
159
filename , ext = os .path .splitext (f )
160
160
if ext != '.csv' :
161
161
continue
162
-
162
+
163
163
fullpath = os .path .join (dirname , f )
164
- logging .info ("Localizing: %s" , filename )
165
-
164
+ logging .info ("Localizing: %s" , filename )
165
+
166
166
with open (fullpath , 'rb' ) as csvfile :
167
167
[fwrite .write ('\n <!-- {0} -->\n ' .format (filename )) for fwrite in allwrites ]
168
168
@@ -182,28 +182,29 @@ def start_localize_android(source_path, all_writes, lang_keys):
182
182
[fwrite .write ('\n ' ) for idx , fwrite in enumerate (allwrites )]
183
183
else :
184
184
[fwrite .write ('\t <string name="{key}">{lang}</string>\n ' .format (key = row_key , lang = row_values [idx ])) for idx , fwrite in enumerate (allwrites )]
185
- [fwrite .write ('</resources>' ) for fwrite in allwrites ]
185
+ [fwrite .write ('</resources>' ) for fwrite in allwrites ]
186
186
[fwrite .close () for fwrite in allwrites ]
187
187
188
188
189
189
# =========================================================================
190
190
# +++++++ Standard boilerplate to call the main() function to begin +++++++
191
191
# =========================================================================
192
- if __name__ == '__main__' :
193
- parser = argparse .ArgumentParser (description = "Locatization commands" )
194
- parser .add_argument ("-p" ,help = "Specify Platform (iOS, Android)" ,dest = "platform" , type = str , required = True )
195
- parser .add_argument ("-i" ,help = "Input source, CSV file path" ,dest = "input" , type = str , required = True )
196
- parser .add_argument ("-o" ,help = "Generated output path for localizable files" ,dest = "output" , type = str , required = True )
197
-
198
- parser .add_argument ("-v" ,
199
- "--verbose" ,
200
- help = "increase output verbosity" ,
201
- action = "store_true" )
202
- args = parser .parse_args ()
192
+
193
+ parser = argparse .ArgumentParser (description = "Locatization commands" )
194
+ parser .add_argument ("-p" ,help = "Specify Platform (iOS, Android)" ,dest = "platform" , type = str , required = True )
195
+ parser .add_argument ("-i" ,help = "Input source, CSV file path" ,dest = "input" , type = str , required = True )
196
+ parser .add_argument ("-o" ,help = "Generated output path for localizable files" ,dest = "output" , type = str , required = True )
197
+
198
+ parser .add_argument ("-v" ,
199
+ "--verbose" ,
200
+ help = "increase output verbosity" ,
201
+ action = "store_true" )
202
+ args = parser .parse_args ()
203
203
204
- # Setup logging
205
- if args .verbose :
206
- loglevel = logging .DEBUG
207
- else :
208
- loglevel = logging .INFO
209
- main (args , loglevel )
204
+ # Setup logging
205
+ if args .verbose :
206
+ loglevel = logging .DEBUG
207
+ else :
208
+ loglevel = logging .INFO
209
+
210
+ main (args , loglevel )
0 commit comments