Index: trunk/l10n-support/scripts/messages.summit =================================================================== --- trunk/l10n-support/scripts/messages.summit (revision 1535155) +++ trunk/l10n-support/scripts/messages.summit (revision 1535156) @@ -1,246 +1,247 @@ # -*- 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="trunk", topdir=S.relpath("../../l10n-kde4/%s/messages" % S.lang), topdir_templates=S.relpath("../../l10n-kde4/%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", ...), ("stable", "kbibtex.appdata", "org.kde.kbibtex.appdata"), ("stable", "kwebkitpart", "webenginepart"), ("stable", "kde-nm-connection-editor", "kde5-nm-connection-editor"), ("trunk", "kwebkitpart", "webenginepart"), ("plasma5lts", "kactivitymanagerd._json_", "kactivities._json_"), ("plasma5lts", "kcmmousetheme", "kcm_cursortheme"), ("plasma5lts", "kcmfonts", "kcm_fonts"), ("plasma5lts", "kcmlaunch", "kcm_launchfeedback"), ("plasma5lts", "joystick", "kcm5_joystick"), ("plasma5lts", "plasma_applet_org.kde.color", "plasma_wallpaper_org.kde.color"), ("plasma5lts", "plasma_applet_org.kde.image", "plasma_wallpaper_org.kde.image"), ("plasma5lts", "kcmworkspaceoptions", "kcm_workspace"), ("plasma5lts", "kcminput", "kcmmouse"), ("plasma5lts", "kcmtranslations", "kcm_translations"), ("plasma5lts", "kcmkwincompositing", "kcmkwincompositing", "kcmkwincommon"), ("plasma5lts", "kcmcolors", "kcm_colors"), + ("plasma5lts", "kcmkwindecoration", "kcm_kwindecoration"), ("stable5", "libsendlater", "akonadi_sendlater_agent"), ("stable5", "kactivitymanagerd._json_", "kactivities._json_"), ("stable5", "libpimcommon", "storageservices", "libpimcommon"), ("stable5", "libmessageviewer", "libmimetreeparser", "libmessageviewer"), ("stable5", "kdevgdb", "kdevdebuggercommon", "kdevgdb"), ("stable5", "kaddressbook", "kaddressbook", "kaddressbook_importexportplugins"), ("stable5", "umbrello_kdevphp", "kdevphp"), ("stable5", "kdevplatform", "kdevplatform", "kdevsourceformatter"), ("stable5", "akonadicontact5", "akonadiimportwizard", "kaddressbook_contacteditor"), ("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", "org.kde.kio-gdrive.appdata", "org.kde.kio_gdrive.appdata"), ("stable5", "kcmkwincompositing", "kcmkwincompositing", "kcmkwincommon"), ("stable5", "kcmcolors", "kcm_colors"), ("stable5", "kcm_kwindecoration", "kcmkwindecoration"), ("trunk5", "plasma_shell_org.kde.plasma.mediacenter", "plasma-mediacenter"), ("trunk5", "libsendlater", "akonadi_sendlater_agent"), ("trunk5", "kactivitymanagerd._json_", "kactivities._json_"), ("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"), ] # 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)