X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=po%2Flyx_pot.py;h=4e15b1f13971cdd6ac1034225d1443463d65ab43;hb=6bf8a0ade8bd804f634a14cd9cd2ac61e7d3a153;hp=a58d8bfe06404d14ae3093f0cb10258244554d59;hpb=ba6d84c917c9b562a417110f6d58424e54721a66;p=lyx.git
diff --git a/po/lyx_pot.py b/po/lyx_pot.py
index a58d8bfe06..4e15b1f139 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):
@@ -78,23 +81,24 @@ def ui_l10n(input_files, output, base):
def layouts_l10n(input_files, output, base, layouttranslations):
- '''Generate pot file from lib/layouts/*.{layout,inc,module}'''
+ '''Generate pot file from lib/layouts/*.{layout,inc,module} and lib/citeengines/*.citeengine'''
ClassDescription = re.compile(r'^\s*#\s*\\Declare(LaTeX|DocBook)Class.*\{(.*)\}$', re.IGNORECASE)
ClassCategory = re.compile(r'^\s*#\s*\\DeclareCategory\{(.*)\}$', re.IGNORECASE)
Style = re.compile(r'^\s*Style\s+(.*\S)\s*$', re.IGNORECASE)
# 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)
CategoryName = re.compile(r'^\s*Category\s+(.*\S)\s*$', re.IGNORECASE)
NameRE = re.compile(r'^\s*#\s*\\DeclareLyXModule.*{(.*)}$', re.IGNORECASE)
+ CiteNameRE = re.compile(r'^\s*#\s*\\DeclareLyXCiteEngine.*\{(.*)\}$', re.IGNORECASE)
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)
@@ -102,7 +106,8 @@ def layouts_l10n(input_files, output, base, layouttranslations):
I18nString = re.compile(r'_\(([^\)]+)\)')
CounterFormat = re.compile(r'^\s*PrettyFormat\s+"?(.*)"?\s*$', re.IGNORECASE)
CiteFormat = re.compile(r'^\s*CiteFormat', re.IGNORECASE)
- KeyVal = re.compile(r'^\s*_\w+\s+(.*\S)\s*$')
+ # Note: preceding and trailing space in the val below matters
+ KeyVal = re.compile(r'^\s*_\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)
@@ -229,6 +234,12 @@ def layouts_l10n(input_files, output, base, layouttranslations):
readingI18nPreamble = True
continue
res = NameRE.search(line)
+ if res != None:
+ string = res.group(1)
+ if not layouttranslations:
+ writeString(out, src, base, lineno + 1, string)
+ continue
+ res = CiteNameRE.search(line)
if res != None:
string = res.group(1)
if not layouttranslations:
@@ -434,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*