X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=po%2Flyx_pot.py;h=665fdcddcfe35d6fd3806aafa5488f72e3b56294;hb=abf44716b282ae39fc8a732296e2ef4c21dd5776;hp=0fc3acaa08c09e0c0ff7a33a429dc6af187a837b;hpb=b9aabe6d891b5347586bdfaeff407552213f94bb;p=lyx.git diff --git a/po/lyx_pot.py b/po/lyx_pot.py index 0fc3acaa08..665fdcddcf 100755 --- a/po/lyx_pot.py +++ b/po/lyx_pot.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python3 # -*- coding: utf-8 -*- # file lyx_pot.py @@ -18,7 +18,7 @@ # from __future__ import print_function -import sys, os, re, getopt +import glob, sys, os, re, getopt import io def relativePath(path, base): @@ -47,6 +47,7 @@ def ui_l10n(input_files, output, base): output = io.open(output, 'w', encoding='utf_8', newline='\n') Submenu = re.compile(r'^[^#]*Submenu\s+"([^"]*)"', re.IGNORECASE) Popupmenu = re.compile(r'^[^#]*PopupMenu\s+"[^"]+"\s+"([^"]*)"', re.IGNORECASE) + Dynamicmenu = re.compile(r'^[^#]*DynamicMenu\s+"[^"]+"\s+"([^"]*)"', re.IGNORECASE) IconPalette = re.compile(r'^[^#]*IconPalette\s+"[^"]+"\s+"([^"]*)"', re.IGNORECASE) Toolbar = re.compile(r'^[^#]*Toolbar\s+"[^"]+"\s+"([^"]*)"', re.IGNORECASE) Item = re.compile(r'[^#]*Item\s+"([^"]*)"', re.IGNORECASE) @@ -59,6 +60,8 @@ def ui_l10n(input_files, output, base): string = string.replace('_', ' ') elif Popupmenu.match(line): (string,) = Popupmenu.match(line).groups() + elif Dynamicmenu.match(line): + (string,) = Dynamicmenu.match(line).groups() elif IconPalette.match(line): (string,) = IconPalette.match(line).groups() elif Toolbar.match(line): @@ -85,7 +88,7 @@ def layouts_l10n(input_files, output, base, layouttranslations): # match LabelString, EndLabelString, LabelStringAppendix and maybe others but no comments LabelString = re.compile(r'^[^#]*LabelString\S*\s+(.*\S)\s*$', re.IGNORECASE) MenuString = re.compile(r'^[^#]*MenuString\S*\s+(.*\S)\s*$', re.IGNORECASE) - OutlinerName = re.compile(r'^[^#]*OutlinerName\s+(\S+|\"[^\"]*\")\s+(\S+|\"[^\"]*\")\s*$', re.IGNORECASE) + OutlinerName = re.compile(r'^[^#]*OutlinerName\s+(\S+|\"[^\"]*\")\s+\"([^\"]*)\"', re.IGNORECASE) Tooltip = re.compile(r'^\s*Tooltip\S*\s+(.*\S)\s*$', re.IGNORECASE) GuiName = re.compile(r'^\s*GuiName\s+(.*\S)\s*$', re.IGNORECASE) ListName = re.compile(r'^\s*ListName\s+(.*\S)\s*$', re.IGNORECASE) @@ -95,7 +98,7 @@ def layouts_l10n(input_files, output, base, layouttranslations): InsetLayout = re.compile(r'^InsetLayout\s+\"?(.*)\"?\s*$', re.IGNORECASE) FlexCheck = re.compile(r'^Flex:(.*)', re.IGNORECASE) CaptionCheck = re.compile(r'^Caption:(.*)', re.IGNORECASE) - DescBegin = re.compile(r'^\s*#DescriptionBegin\s*$', re.IGNORECASE) + DescBegin = re.compile(r'^\s*#\s*DescriptionBegin\s*$', re.IGNORECASE) DescEnd = re.compile(r'^\s*#\s*DescriptionEnd\s*$', re.IGNORECASE) Category = re.compile(r'^\s*#\s*Category:\s+(.*\S)\s*$', re.IGNORECASE) I18nPreamble = re.compile(r'^\s*((Lang)|(Babel))Preamble\s*$', re.IGNORECASE) @@ -104,7 +107,7 @@ def layouts_l10n(input_files, output, base, layouttranslations): CounterFormat = re.compile(r'^\s*PrettyFormat\s+"?(.*)"?\s*$', re.IGNORECASE) CiteFormat = re.compile(r'^\s*CiteFormat', re.IGNORECASE) # Note: preceding and trailing space in the val below matters - KeyVal = re.compile(r'^\s*_\w+\s(.*\S)*$') + KeyVal = re.compile(r'^\s*B?_\w+\s(.*\S)*$') Float = re.compile(r'^\s*Float\s*$', re.IGNORECASE) UsesFloatPkg = re.compile(r'^\s*UsesFloatPkg\s+(.*\S)\s*$', re.IGNORECASE) IsPredefined = re.compile(r'^\s*IsPredefined\s+(.*\S)\s*$', re.IGNORECASE) @@ -442,8 +445,8 @@ def layouts_l10n(input_files, output, base, layouttranslations): out.close() -def qt4_l10n(input_files, output, base): - '''Generate pot file from src/frontends/qt4/ui/*.ui''' +def qt_l10n(input_files, output, base): + '''Generate pot file from src/frontends/qt/ui/*.ui''' output = io.open(output, 'w', encoding='utf_8', newline='\n') pat = re.compile(r'\s*(.*)') prop = re.compile(r'\s*