~chromium-team/chromium-browser/translations-pump

« back to all changes in this revision

Viewing changes to fileformats/grd.py

  • Committer: Chad Miller
  • Date: 2013-08-16 14:10:56 UTC
  • Revision ID: chad.miller@canonical.com-20130816141056-v51xndsustwcjg6i
Fix exporting gettext placeholders.

Move testing to top of main run function.

Make getting upstream sources a seperate step than running the exporter.

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
        return
149
149
 
150
150
    if node.attrib.get("use_name_for_id", "false").lower().strip() == "true":
151
 
        logging.info("Skipping GRD item %s that uses its name as its GRDSID.", node)
 
151
        logging.debug("Skipping GRD item %s that uses its name as its GRDSID.", node)
152
152
        return
153
153
 
154
154
    simplified_message, grdsid = xtb_message(node)
255
255
        pass
256
256
    with open(dest_filename, "wb") as f:
257
257
        tree.write(f, encoding="utf-8")
258
 
    logging.info("Wrote XTB %s", dest_filename)
 
258
    logging.debug("Wrote XTB %s", dest_filename)
259
259
 
260
260
def add_missing_grd_files_and_export_xtb(source_txln_info, root, source_grd_filename, dest_grd_filename, destination_container):
261
261
    grdsid_list_to_insert = get_grdsids(root, source_grd_filename)
262
262
 
263
263
    translations_tags = root.findall("translations")
264
264
    if len(translations_tags) == 0:
265
 
        logging.info("No translations tag to update.")
 
265
        logging.info("No translations tag in %r, so not exporting. Skipping it.", source_grd_filename,)
266
266
        return
267
267
    elif len(translations_tags) > 1:
268
 
        logging.error("%s translations tag to update. I don't know what to do with these.")
 
268
        logging.error("%s translations tag to update in %r. I don't know what to do with these.", len(translations_tags), source_grd_filename)
269
269
        return
270
270
    translations_tag = translations_tags[0]
271
271
 
349
349
        pass
350
350
    with open(dest_filename, "wb") as f:
351
351
        tree.write(f, encoding="utf-8")
352
 
    logging.info("Wrote GRD %s", dest_filename)
 
352
    logging.debug("Wrote GRD %s", dest_filename)