Index: trunk/l10n-support/scripts/messages.summit =================================================================== --- trunk/l10n-support/scripts/messages.summit (revision 1570760) +++ trunk/l10n-support/scripts/messages.summit (revision 1570761) @@ -1,218 +1,217 @@ # -*- coding: UTF-8 -*- # kate: syntax Python; # This file is a summit configuration for Pology's posummit script. import os # ---------------------------------------- # Summit and branch locations and IDs. # Summit-over-templates mode. S.over_templates = True # Location of summit catalogs and templates. S.summit = dict( topdir=S.relpath("../%s/summit/messages" % S.lang), topdir_templates=S.relpath("../%s/summit/messages" % S.templates_lang), ) # Branch IDs and locations of branch catalogs and templates. S.branches = [ dict( id="trunk5", topdir=S.relpath("../../l10n-kf5/%s/messages" % S.lang), topdir_templates=S.relpath("../../l10n-kf5/%s/messages" % S.templates_lang), ), dict( id="stable5", topdir=S.relpath("../../../branches/stable/l10n-kf5/%s/messages" % S.lang), topdir_templates=S.relpath("../../../branches/stable/l10n-kf5/%s/messages" % S.templates_lang), ), dict( id="plasma5lts", topdir=S.relpath("../../../branches/stable/l10n-kf5-plasma-lts/%s/messages" % S.lang), topdir_templates=S.relpath("../../../branches/stable/l10n-kf5-plasma-lts/%s/messages" % S.templates_lang), ), dict( id="stable", topdir=S.relpath("../../../branches/stable/l10n-kde4/%s/messages" % S.lang), topdir_templates=S.relpath("../../../branches/stable/l10n-kde4/%s/messages" % S.templates_lang), ), ] # Set path transformations. transform_path_summit_names = {} transform_path_branch_names = {} def make_split_branch_path (branch_id): def splitf (branch_path): branch_subdir = os.path.dirname(branch_path) branch_filename = os.path.basename(branch_path) branch_name = branch_filename[:branch_filename.rfind(".")] summit_name = transform_path_summit_names.get( (branch_id, branch_name), branch_name) return summit_name, branch_subdir return splitf def make_join_branch_path (branch_id): def joinf (summit_name, summit_subdir, by_lang): branch_name = transform_path_branch_names.get( (branch_id, summit_name), summit_name) branch_filename = branch_name + ".po" branch_path = os.path.join(summit_subdir, branch_filename) return branch_path return joinf from pology.fsops import collect_catalogs transform_suffix_force = set([ "kdesupport-phonon" ]) for branch in S.branches: branch_id = branch["id"] branch_topdir_templates = branch["topdir_templates"] for full_branch_path in collect_catalogs(branch_topdir_templates): branch_path = full_branch_path[len(branch_topdir_templates) + 1:] branch_subdir = os.path.dirname(branch_path) branch_filename = os.path.basename(branch_path) branch_name = branch_filename[:branch_filename.rfind(".")] summit_name = branch_name for prefix in ("desktop", "json"): if branch_name.startswith(prefix + "_"): branch_name_split = branch_name.split("_", 2) type_suffix = "_%s_" % prefix if len(branch_name_split) == 3: summit_name = branch_name_split[2] + "." + type_suffix else: summit_name = branch_name_split[1] + "." + type_suffix for suffix in ("_desktop_", "_json_"): if branch_name.endswith("." + suffix): branch_name_base = branch_name[:branch_name.rfind(".")] branch_name_split = branch_name_base.split("_", 1) type_suffix = suffix if len(branch_name_split) == 2: if ( branch_name_split[0] == branch_subdir or branch_name_split[0] in transform_suffix_force ): summit_name = branch_name_split[1] + "." + type_suffix if summit_name != branch_name: transform_path_summit_names[(branch_id, branch_name)] = summit_name transform_path_branch_names[(branch_id, summit_name)] = branch_name branch["transform_path"] = (make_split_branch_path(branch_id), make_join_branch_path(branch_id)) # Set X-Qt-Contexts header on Qt catalogs. def set_header_qt_contexts (cat): hdr = cat.header hdr.set_field(u"X-Qt-Contexts", u"true") return 0 from pology.proj.kde.cattype import is_qt_cat S.hook_on_scatter_cat.extend([ (set_header_qt_contexts, r"", is_qt_cat), ]) # ---------------------------------------- # Manual mappings from branch to summit catalogs, needed when: # - catalog is renamed in trunk, and not in stable, # - catalog from stable is split into two or more catalogs in trunk, # - two or more catalogs in stable are combined into single catalog in trunk, # - etc. # *Not* needed when a catalog only changes the module. S.mappings = [ # ("branch_id", "branch_catalog", "summit_catalog_1", ...), ("plasma5lts", "kcmkwinrules", "kcm_kwinrules"), ("stable5", "libsendlater", "akonadi_sendlater_agent"), ("stable5", "kdevgdb", "kdevdebuggercommon", "kdevgdb"), ("stable5", "umbrello_kdevphp", "kdevphp"), ("stable5", "kdevplatform", "kdevplatform", "kdevsourceformatter"), ("stable5", "akonadi_davgroupware_resource", "akonadi_davgroupware_resource", "libkdav"), ("stable5", "latte-dock", "latte-dock", "plasma_containmentactions_lattecontextmenu"), ("stable5", "messageviewer_semantic_plugin", "messageviewer_semantic_plugin", "kitinerary"), ("stable5", "akonadi-contacts._desktop_", "kcontacts._desktop_", "akonadi-contacts._desktop_"), ("stable5", "akonadi_googlecalendar_resource", "akonadi_google_resource"), ("trunk5", "kaddressbook", "kaddressbook", "kaddressbook_importexportplugins"), ("trunk5", "kwebkitpart", "webenginepart"), ("trunk5", "umbrello_kdevphp", "kdevphp"), ("trunk5", "umbrello_kdevphp5", "kdevphp"), ("trunk5", "akonadi_davgroupware_resource", "akonadi_davgroupware_resource", "libkdav"), ("trunk5", "messageviewer_semantic_plugin", "messageviewer_semantic_plugin", "kitinerary"), ("trunk5", "akonadi-contacts._desktop_", "kcontacts._desktop_", "akonadi-contacts._desktop_"), - ("trunk5", "org.kde.mobile.alligator.appdata", "org.kde.alligator.appdata"), ] # Manual mappings from branch to summit subdirectories, needed when # catalogs from several branch subdirectories should reside in # single summit subdirectory. S.subdir_mappings = [ # ("branch_id", "branch_subdir", "summit_subdir"), ] # Subdirectory precedence. # Used in cases of several same-named catalogs in same branch. subdir_list_path = S.relpath("summit_subdir_precedence") S.subdir_precedence = [l.strip() for l in open(subdir_list_path).readlines()] # ---------------------------------------- # Formatting. # Wrap messages (on column)? S.summit_wrap = False S.branches_wrap = True # Fine-wrap messages (on markup tags, etc.)? S.summit_fine_wrap = True S.branches_fine_wrap = False # Normalize branch templates before gathering to have better # source references and message ordering in summit templates. if "gather" in S.opmodes and S.lang == S.templates_lang: # General dummy extraction files for all catalogs. dumsrcs = ("rc.cpp", "rc.py", "tips.cpp", "tips.cc") # Special dummy extraction files per catalog (single or list of files). dumsrcs_per_cat = { "kcells": "xml_doc.cpp", "kregexpeditor": "predefined-regexps.cpp", "libmuon": "categoriesxml.cpp", "okular_ghostview": "rc_okular_ghostview.cpp", "okular_www": "news.cpp", "sheets": "xml_doc.cpp", "system-config-printer-kde": "ui.py", } # Starts of true source files in extracted comments. ecsrcheads = ("i18n: file:",) # Starts of extracted contexts in extracted comments. ecctxheads = ("i18n: ectx:",) # Assemble the normalization hook. from pology.normalize import demangle_srcrefs, uniq_source from pology.normalize import uniq_auto_comment demangle_srcrefs_h = demangle_srcrefs(collsrcs=dumsrcs, collsrcmap=dumsrcs_per_cat, truesrcheads=ecsrcheads) uniq_auto_comment_h = uniq_auto_comment(onlyheads=ecctxheads) def normalize_template (cat): for msg in cat: demangle_srcrefs_h(msg, cat) uniq_source(msg, cat) uniq_auto_comment_h(msg, cat) cat.sort_by_source() S.hook_on_gather_cat_branch.extend([ (normalize_template,), ]) # ---------------------------------------- # Bookkeeping. # Version control system for the catalogs, if any. S.version_control = "svn" # ---------------------------------------- # Custom settings per language # (this should come last to allow overrides). extras_file = S.relpath("../%s/summit/messages.extras.summit" % S.lang) if os.path.isfile(extras_file): S.include(extras_file)