Skip to content

Commit fe8eb2c

Browse files
ilmari-lauhakangascloph
authored andcommitted
tdf#140215 Simplify the handling of .ulf files
Now the headings in the ulf files for .desktop files are in the form [filename_Key] Gallery names are also adjusted to fit the new scheme, where there is no longer a need to pass a --key argument to desktop-translate.py Sync comments with .desktop files and the remaining .ulf and remove obsolete Mandriva Linux meta data while at it. Script to mass-replace relevant names in translations will be provided to infra. Change-Id: I87e8028aa5b66f5f5560efa62ddd9b1e5b61c49c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138455 Tested-by: Jenkins Reviewed-by: Sophie Gautier <[email protected]> Reviewed-by: Christian Lohmaier <[email protected]>
1 parent 87e7a2f commit fe8eb2c

16 files changed

+122
-128
lines changed

extras/CustomTarget_gallsystem.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ $(call gb_CustomTarget_get_workdir,extras/gallsysstr)/%.str : \
3030
$(SRCDIR)/solenv/bin/desktop-translate.py
3131
mkdir -p $(@D)/$* && cp $(SRCDIR)/extras/source/gallery/gallery_system/dummy.str $(@D)/$*/$*.str && \
3232
$(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/solenv/bin/desktop-translate.py \
33-
--ext "str" --key "name" -d $(@D)/$*/ $(@D)/extras_gallsystem.ulf && \
33+
--ext "str" -d $(@D)/$*/ $(@D)/extras_gallsystem.ulf && \
3434
mv $(@D)/$*/$*.str $@
3535

3636
# vim: set noet sw=4 ts=4:

extras/source/gallery/share/gallery_names.ulf

+10-10
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,34 @@
77
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
88
*/
99

10-
[arrows]
10+
[arrows_name]
1111
en-US = "Arrows"
1212

13-
[backgrounds]
13+
[backgrounds_name]
1414
en-US = "Backgrounds"
1515

16-
[bullets]
16+
[bullets_name]
1717
en-US= "Bullets"
1818

19-
[bpmn]
19+
[bpmn_name]
2020
en-US = "BPMN"
2121

22-
[diagrams]
22+
[diagrams_name]
2323
en-US = "Diagrams"
2424

25-
[flowchart]
25+
[flowchart_name]
2626
en-US = "Flow chart"
2727

28-
[icons]
28+
[icons_name]
2929
en-US = "Icons"
3030

31-
[network]
31+
[network_name]
3232
en-US = "Network"
3333

34-
[shapes]
34+
[shapes_name]
3535
en-US = "Shapes"
3636

37-
[sounds]
37+
[sounds_name]
3838
en-US = "Sounds"
3939

4040
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

solenv/bin/desktop-translate.py

+15-16
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def encode_desktop_string(s_value):
5454
parser = argparse.ArgumentParser()
5555
parser.add_argument("-p", dest="productname", default="LibreOffice")
5656
parser.add_argument("-d", dest="workdir", default=".")
57-
parser.add_argument("--key", dest="key")
5857
parser.add_argument("--prefix", dest="prefix", default="")
5958
parser.add_argument("--ext", dest="ext")
6059
parser.add_argument("--template-dir", dest="template_dir", default=None)
@@ -67,13 +66,6 @@ def encode_desktop_string(s_value):
6766
else:
6867
template_dir = o.template_dir
6968

70-
# hack for unity section
71-
if o.key == "UnityQuickList":
72-
OUTKEY = "Name"
73-
else:
74-
OUTKEY = o.key
75-
76-
7769
templates = {}
7870

7971
# open input file
@@ -85,14 +77,18 @@ def encode_desktop_string(s_value):
8577
for line in source:
8678
if line.strip() == "":
8779
continue
80+
# the headings in the ulf files for .desktop files are in the form [filename_Key]
8881
if line[0] == "[":
89-
template = line.split("]", 1)[0][1:]
82+
heading = line.split("]", 1)[0][1:]
83+
template = heading.split("_", 1)[0]
84+
key = heading.split("_", 1)[1]
9085
entry = {}
9186
# For every section in the specified ulf file there should exist
9287
# a template file in $workdir ..
9388
entry["outfile"] = f"{template_dir}{template}.{o.ext}"
9489
entry["translations"] = {}
95-
templates[template] = entry
90+
entry["key"] = key
91+
templates[heading] = entry
9692
else:
9793
# split locale = "value" into 2 strings
9894
if " = " not in line:
@@ -116,7 +112,7 @@ def encode_desktop_string(s_value):
116112

117113
locale = locale.replace("-", "_")
118114

119-
templates[template]["translations"][locale] = value
115+
templates[heading]["translations"][locale] = value
120116

121117
source.close()
122118

@@ -145,15 +141,18 @@ def encode_desktop_string(s_value):
145141
# emit the template to the output file
146142
for line in template_file:
147143
keyline = line
148-
if keyline.startswith(o.key):
149-
keyline = OUTKEY + keyline[len(o.key) :]
144+
if keyline.startswith(entries["key"]):
145+
# hack for Unity section
146+
if entries["key"] == "UnityQuickList":
147+
OUTKEY = "Name"
148+
else:
149+
OUTKEY = entries["key"]
150+
keyline = OUTKEY + keyline[len(entries["key"]) :]
150151
outfile.write(keyline)
151-
if o.key in line:
152+
if entries["key"] in line:
152153
translations = entries["translations"]
153154
for locale in sorted(translations.keys()):
154155
value = translations.get(locale, None)
155-
# print "locale is $locale\n";
156-
# print "value is $value\n";
157156
if value:
158157
if o.ext in ("desktop", "str"):
159158
if o.ext == "desktop":

solenv/gbuild/Gallery.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ define gb_Gallery__command_str
3737
cp -f $(GALLERY_STRFILE) $@ && \
3838
$(call gb_ExternalExecutable_get_command,python) \
3939
$(gb_Gallery_TRANSLATE) \
40-
--ext "str" --key "name" \
40+
--ext "str" \
4141
-d $(GALLERY_WORKDIR) \
4242
$(GALLERY_ULFFILE)
4343
endef

sysui/CustomTarget_share.mk

+2-8
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ share_ICONS := $(foreach size,16x16 32x32 48x48,\
110110

111111
MIMEDESKTOPS := $(foreach mime,$(MIMELIST),$(share_SRCDIR)/mimetypes/$(mime).desktop)
112112
ULFS := documents.ulf \
113-
launcher_comment.ulf \
114-
launcher_genericname.ulf \
115-
launcher_unityquicklist.ulf
113+
launcher.ulf
116114

117115
$(eval $(call gb_CustomTarget_CustomTarget,sysui/share))
118116

@@ -211,11 +209,7 @@ $(share_WORKDIR)/%/build.flag: $(share_SRCDIR)/share/brand.pl $(LAUNCHERS) \
211209
$(brand_URIPARAM) \
212210
--iconprefix '$${UNIXBASISROOTNAME}-' $(LAUNCHERS) $(share_WORKDIR)/$*
213211
$(call gb_ExternalExecutable_get_command,python) $(share_TRANSLATE) -p $(PRODUCTNAME.$*)$(PRODUCTVERSION) -d $(share_WORKDIR)/$* \
214-
--ext "desktop" --key "Comment" $(share_WORKDIR)/launcher_comment.ulf
215-
$(call gb_ExternalExecutable_get_command,python) $(share_TRANSLATE) -p $(PRODUCTNAME.$*)$(PRODUCTVERSION) -d $(share_WORKDIR)/$* \
216-
--ext "desktop" --key "GenericName" $(share_WORKDIR)/launcher_genericname.ulf
217-
$(call gb_ExternalExecutable_get_command,python) $(share_TRANSLATE) -p $(PRODUCTNAME.$*)$(PRODUCTVERSION) -d $(share_WORKDIR)/$* \
218-
--ext "desktop" --key "UnityQuickList" $(share_WORKDIR)/launcher_unityquicklist.ulf
212+
--ext "desktop" $(share_WORKDIR)/launcher.ulf
219213
touch $@
220214
$(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),PRL)
221215

sysui/desktop/menus/base.desktop

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ Version=1.0
2020
Terminal=false
2121
Icon=base
2222
Type=Application
23-
Categories=Office;Database;X-Red-Hat-Base;X-MandrivaLinux-MoreApplications-Databases;
23+
Categories=Office;Database;X-Red-Hat-Base;
2424
Exec=${UNIXBASISROOTNAME} --base %%FILE%%
2525
MimeType=application/vnd.oasis.opendocument.database;application/vnd.sun.xml.base;
2626
Name=%PRODUCTNAME Base
2727
GenericName=Database Development
28-
Comment=Manage databases, create queries and reports to track and manage your information
28+
Comment=Manage databases, create queries and reports to track and manage your information.
2929
StartupNotify=true
3030
X-GIO-NoFuse=true
3131
Keywords=Data;SQL;

sysui/desktop/menus/calc.desktop

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ Version=1.0
2020
Terminal=false
2121
Icon=calc
2222
Type=Application
23-
Categories=Office;Spreadsheet;X-Red-Hat-Base;X-MandrivaLinux-Office-Spreadsheets;
23+
Categories=Office;Spreadsheet;X-Red-Hat-Base;
2424
Exec=${UNIXBASISROOTNAME} --calc %%FILE%%
2525
MimeType=application/vnd.oasis.opendocument.spreadsheet;application/vnd.oasis.opendocument.spreadsheet-template;application/vnd.sun.xml.calc;application/vnd.sun.xml.calc.template;application/msexcel;application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.ms-excel.sheet.macroEnabled.12;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.template.macroEnabled.12;application/vnd.ms-excel.sheet.binary.macroEnabled.12;text/csv;application/x-dbf;text/spreadsheet;application/csv;application/excel;application/tab-separated-values;application/vnd.lotus-1-2-3;application/vnd.oasis.opendocument.chart;application/vnd.oasis.opendocument.chart-template;application/x-dbase;application/x-dos_ms_excel;application/x-excel;application/x-msexcel;application/x-ms-excel;application/x-quattropro;application/x-123;text/comma-separated-values;text/tab-separated-values;text/x-comma-separated-values;text/x-csv;application/vnd.oasis.opendocument.spreadsheet-flat-xml;application/vnd.ms-works;application/clarisworks;application/x-iwork-numbers-sffnumbers;application/vnd.apple.numbers;application/x-starcalc;
2626
Name=%PRODUCTNAME Calc
2727
GenericName=Spreadsheet
28-
Comment=Perform calculations, analyze information and manage lists in spreadsheets
28+
Comment=Perform calculations, analyze information and manage lists in spreadsheets.
2929
StartupNotify=true
3030
X-GIO-NoFuse=true
3131
Keywords=Accounting;Stats;OpenDocument Spreadsheet;Chart;Microsoft Excel;Microsoft Works;OpenOffice Calc;ods;xls;xlsx;

sysui/desktop/menus/draw.desktop

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ Version=1.0
2020
Terminal=false
2121
Icon=draw
2222
Type=Application
23-
Categories=Office;FlowChart;Graphics;2DGraphics;VectorGraphics;X-Red-Hat-Base;X-MandrivaLinux-Office-Drawing;
23+
Categories=Office;FlowChart;Graphics;2DGraphics;VectorGraphics;X-Red-Hat-Base;
2424
Exec=${UNIXBASISROOTNAME} --draw %%FILE%%
2525
MimeType=application/vnd.oasis.opendocument.graphics;application/vnd.oasis.opendocument.graphics-flat-xml;application/vnd.oasis.opendocument.graphics-template;application/vnd.sun.xml.draw;application/vnd.sun.xml.draw.template;application/vnd.visio;application/x-wpg;application/vnd.corel-draw;application/vnd.ms-publisher;image/x-freehand;application/clarisworks;application/x-pagemaker;application/pdf;application/x-stardraw;image/x-emf;image/x-wmf;
2626
Name=%PRODUCTNAME Draw
2727
GenericName=Drawing Program
28-
Comment=Create and edit drawings, flow charts and logos
28+
Comment=Create and edit drawings, flow charts and logos.
2929
StartupNotify=true
3030
X-GIO-NoFuse=true
3131
Keywords=Vector;Schema;Diagram;Layout;OpenDocument Graphics;Microsoft Publisher;Microsoft Visio;Corel Draw;cdr;odg;svg;pdf;vsd;

sysui/desktop/menus/impress.desktop

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ Version=1.0
2020
Terminal=false
2121
Icon=impress
2222
Type=Application
23-
Categories=Office;Presentation;X-Red-Hat-Base;X-MandrivaLinux-Office-Presentations;
23+
Categories=Office;Presentation;X-Red-Hat-Base;
2424
Exec=${UNIXBASISROOTNAME} --impress %%FILE%%
2525
MimeType=application/vnd.oasis.opendocument.presentation;application/vnd.oasis.opendocument.presentation-template;application/vnd.sun.xml.impress;application/vnd.sun.xml.impress.template;application/mspowerpoint;application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.ms-powerpoint.presentation.macroEnabled.12;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.ms-powerpoint.template.macroEnabled.12;application/vnd.openxmlformats-officedocument.presentationml.slide;application/vnd.openxmlformats-officedocument.presentationml.slideshow;application/vnd.ms-powerpoint.slideshow.macroEnabled.12;application/vnd.oasis.opendocument.presentation-flat-xml;application/x-iwork-keynote-sffkey;application/vnd.apple.keynote;
2626
Name=%PRODUCTNAME Impress
2727
GenericName=Presentation
28-
Comment=Create and edit presentations for slideshows, meetings and Web pages
28+
Comment=Create and edit presentations for slideshows, meetings and Web pages.
2929
StartupNotify=true
3030
X-GIO-NoFuse=true
3131
Keywords=Slideshow;Slides;OpenDocument Presentation;Microsoft PowerPoint;Microsoft Works;OpenOffice Impress;odp;ppt;pptx;

sysui/desktop/menus/math.desktop

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ Terminal=false
2121
NoDisplay=false
2222
Icon=math
2323
Type=Application
24-
Categories=Office;Education;Science;Math;X-Red-Hat-Base;X-MandrivaLinux-Office-Other;
24+
Categories=Office;Education;Science;Math;X-Red-Hat-Base;
2525
Exec=${UNIXBASISROOTNAME} --math %%FILE%%
2626
MimeType=application/vnd.oasis.opendocument.formula;application/vnd.sun.xml.math;application/vnd.oasis.opendocument.formula-template;text/mathml;application/mathml+xml;
2727
Name=%PRODUCTNAME Math
2828
GenericName=Formula Editor
29-
Comment=Create and edit scientific formulas and equations
29+
Comment=Create and edit scientific formulas and equations.
3030
StartupNotify=true
3131
X-GIO-NoFuse=true
3232
Keywords=Equation;OpenDocument Formula;Formula;odf;MathML;

sysui/desktop/menus/startcenter.desktop

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Terminal=false
2121
NoDisplay=false
2222
Icon=startcenter
2323
Type=Application
24-
Categories=Office;X-Red-Hat-Base;X-SuSE-Core-Office;X-MandrivaLinux-Office-Other;
24+
Categories=Office;X-Red-Hat-Base;X-SuSE-Core-Office;
2525
Exec=${UNIXBASISROOTNAME} %%FILE%%
2626
MimeType=application/vnd.openofficeorg.extension;x-scheme-handler/vnd.libreoffice.cmis;x-scheme-handler/vnd.sun.star.webdav;x-scheme-handler/vnd.sun.star.webdavs;x-scheme-handler/vnd.libreoffice.command;x-scheme-handler/ms-word;x-scheme-handler/ms-powerpoint;x-scheme-handler/ms-excel;x-scheme-handler/ms-visio;x-scheme-handler/ms-access;
2727
Name=%PRODUCTNAME

sysui/desktop/menus/writer.desktop

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ Version=1.0
2020
Terminal=false
2121
Icon=writer
2222
Type=Application
23-
Categories=Office;WordProcessor;X-Red-Hat-Base;X-MandrivaLinux-Office-Wordprocessors;
23+
Categories=Office;WordProcessor;X-Red-Hat-Base;
2424
Exec=${UNIXBASISROOTNAME} --writer %%FILE%%
2525
MimeType=application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.text-template;application/vnd.oasis.opendocument.text-web;application/vnd.oasis.opendocument.text-master;application/vnd.oasis.opendocument.text-master-template;application/vnd.sun.xml.writer;application/vnd.sun.xml.writer.template;application/vnd.sun.xml.writer.global;application/msword;application/vnd.ms-word;application/x-doc;application/x-hwp;application/rtf;text/rtf;application/vnd.wordperfect;application/wordperfect;application/vnd.lotus-wordpro;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.ms-word.document.macroEnabled.12;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.template.macroEnabled.12;application/vnd.ms-works;application/vnd.stardivision.writer-global;application/x-extension-txt;application/x-t602;text/plain;application/vnd.oasis.opendocument.text-flat-xml;application/x-fictionbook+xml;application/macwriteii;application/x-aportisdoc;application/prs.plucker;application/vnd.palm;application/clarisworks;application/x-sony-bbeb;application/x-abiword;application/x-iwork-pages-sffpages;application/vnd.apple.pages;application/x-mswrite;application/x-starwriter;
2626
Name=%PRODUCTNAME Writer
2727
GenericName=Word Processor
28-
Comment=Create and edit text and graphics in letters, reports, documents and Web pages
28+
Comment=Create and edit text and graphics in letters, reports, documents and Web pages.
2929
StartupNotify=true
3030
X-GIO-NoFuse=true
3131
Keywords=Text;Letter;Fax;Document;OpenDocument Text;Microsoft Word;Microsoft Works;Lotus WordPro;OpenOffice Writer;CV;odt;doc;docx;rtf;

sysui/desktop/share/launcher.ulf

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* This file is part of the LibreOffice project.
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+
*
8+
* This file incorporates work covered by the following license notice:
9+
*
10+
* Licensed to the Apache Software Foundation (ASF) under one or more
11+
* contributor license agreements. See the NOTICE file distributed
12+
* with this work for additional information regarding copyright
13+
* ownership. The ASF licenses this file to you under the Apache
14+
* License, Version 2.0 (the "License"); you may not use this file
15+
* except in compliance with the License. You may obtain a copy of
16+
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
17+
*/
18+
19+
[writer_Comment]
20+
en-US = "Create and edit text and graphics in letters, reports, documents and Web pages."
21+
22+
[impress_Comment]
23+
en-US = "Create and edit presentations for slideshows, meetings and Web pages."
24+
25+
[draw_Comment]
26+
en-US = "Create and edit drawings, flow charts and logos."
27+
28+
[calc_Comment]
29+
en-US = "Perform calculations, analyze information and manage lists in spreadsheets."
30+
31+
[math_Comment]
32+
en-US = "Create and edit scientific formulas and equations."
33+
34+
[base_Comment]
35+
en-US = "Manage databases, create queries and reports to track and manage your information."
36+
37+
[startcenter_Comment]
38+
en-US = "Launch applications to create text documents, spreadsheets, presentations, drawings, formulas, and databases, or open recently used documents."
39+
40+
[writer_GenericName]
41+
en-US = "Word Processor"
42+
43+
[impress_GenericName]
44+
en-US = "Presentation"
45+
46+
[calc_GenericName]
47+
en-US = "Spreadsheet"
48+
49+
[base_GenericName]
50+
en-US = "Database Development"
51+
52+
[math_GenericName]
53+
en-US = "Formula Editor"
54+
55+
[draw_GenericName]
56+
en-US = "Drawing Program"
57+
58+
[startcenter_GenericName]
59+
en-US = "Office"
60+
61+
[xsltfilter_GenericName]
62+
en-US = "XSLT based filters"
63+
64+
[writer_UnityQuickList]
65+
en-US = "New Document"
66+
67+
[impress_UnityQuickList]
68+
en-US = "New Presentation"
69+
70+
[calc_UnityQuickList]
71+
en-US = "New Spreadsheet"
72+
73+
[base_UnityQuickList]
74+
en-US = "New Database"
75+
76+
[math_UnityQuickList]
77+
en-US = "New Formula"
78+
79+
[draw_UnityQuickList]
80+
en-US = "New Drawing"

sysui/desktop/share/launcher_comment.ulf

-39
This file was deleted.

0 commit comments

Comments
 (0)