diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-09-14 15:57:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-09-14 16:54:09 +0100 |
commit | 7fdf1663ed8e689e7fb154ab22a9dcb7fc7bf43c (patch) | |
tree | aa5ab0f18d4f5e17825c482cec1eb38015465b37 /solenv | |
parent | 54a86c8f0c97a47b5ed7a8882f19e9af0c1682b5 (diff) |
remove interim update module for gettext support
Change-Id: I05df619848cde842a5cda79d20e013914ce882d4
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/bin/dummy.po | 18 | ||||
-rwxr-xr-x | solenv/bin/interim-update-module-for-gettext | 91 | ||||
-rw-r--r-- | solenv/gbuild/AllLangMoTarget.mk | 13 |
3 files changed, 25 insertions, 97 deletions
diff --git a/solenv/bin/dummy.po b/solenv/bin/dummy.po new file mode 100644 index 000000000000..a05e526b8b98 --- /dev/null +++ b/solenv/bin/dummy.po @@ -0,0 +1,18 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-09-14 15:54+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" diff --git a/solenv/bin/interim-update-module-for-gettext b/solenv/bin/interim-update-module-for-gettext deleted file mode 100755 index 596401f5ca23..000000000000 --- a/solenv/bin/interim-update-module-for-gettext +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python3 - -import binascii -import polib -from os import listdir, walk, remove -from os.path import isdir, join - -import sys - -if len(sys.argv) < 2: - print(" Syntax: interim-update-module-for-gettext path/to/dir/of/languages/language/module output.po") - sys.exit(2) - -uiline = False - -subpath = sys.argv[1] -print("interim-update-for-gettext: processing " + subpath) -messages = None -npos = 0 -for dirpath, dirname, filenames in walk(subpath): - for filename in filenames: - ipath = join(dirpath, filename) - print("interim-update-for-gettext: merging " + ipath) - po = polib.pofile(ipath) - if len(po) != 0: - samplefile = po[0].occurrences[0][0] - if samplefile.endswith(".src") or samplefile.endswith(".ui"): - if npos == 0: - messages = po - else: - for entry in po: - messages.append(entry) - npos = npos + 1 - -if npos > 0: - middle = 0 - for entry in messages: - if not len(entry.occurrences): - continue - location = entry.occurrences[0][0] - if location.endswith(".ui"): - uiline = True - else: - uiline = False - lines = entry.msgctxt.split('\n') - if uiline: - widgetid = lines[1] - typeid = lines[2] - entry.msgctxt = location[:-3] + "|" + widgetid - if typeid == "tooltip_text": - entry.msgctxt = entry.msgctxt + "|" + typeid - if entry.msgctxt == 'calloutpage|position' and entry.msgid == 'Middle': - middle = middle + 1 - if middle == 2: - entry.msgid = "Center" - else: - ctxline = lines[1] - if (ctxline.endswith("+RID_SC_FUNC_DESCRIPTIONS_START")): - ctxline = ctxline[:-len("+RID_SC_FUNC_DESCRIPTIONS_START")] - elif (ctxline.endswith("+RID_GLOBSTR_OFFSET")): - ctxline = ctxline[:-len("+RID_GLOBSTR_OFFSET")] - entry.msgctxt = ctxline - comments = entry.comment.split('\n') - keyid = entry.msgctxt + '|' + entry.msgid - comments[-1] = polib.genKeyId(keyid.encode('utf-8')) - entry.comment = "\n".join(comments) - if (len(entry.msgid) and len(entry.msgstr)): - if (entry.msgid[0] == '\n' and entry.msgstr[0] != '\n'): - entry.msgstr = '\n' + entry.msgstr - elif (entry.msgid[0] != '\n' and entry.msgstr[0] == '\n'): - entry.msgstr = ' ' + entry.msgstr - if (entry.msgid[-1] == '\n' and entry.msgstr[-1] != '\n'): - entry.msgstr = entry.msgstr + '\n' - elif (entry.msgid[-1] != '\n' and entry.msgstr[-1] == '\n'): - entry.msgstr = entry.msgstr[:-1] - -else: - messages = polib.POFile() - messages.metadata = { - 'Project-Id-Version': '1.0', - 'Report-Msgid-Bugs-To': 'you@example.com', - 'POT-Creation-Date': '2007-10-18 14:00+0100', - 'PO-Revision-Date': '2007-10-18 14:00+0100', - 'Last-Translator': 'you <you@example.com>', - 'Language-Team': 'English <yourteam@example.com>', - 'MIME-Version': '1.0', - 'Content-Type': 'text/plain; charset=utf-8', - 'Content-Transfer-Encoding': '8bit', - } - -messages.save(sys.argv[2]) diff --git a/solenv/gbuild/AllLangMoTarget.mk b/solenv/gbuild/AllLangMoTarget.mk index a16dc87f0064..64f6ce84d074 100644 --- a/solenv/gbuild/AllLangMoTarget.mk +++ b/solenv/gbuild/AllLangMoTarget.mk @@ -32,18 +32,19 @@ $(call gb_MoTarget_get_clean_target,%) : $(call gb_MoTarget_get_target,$*) \ $(call gb_MoTarget_get_install_target,$*)) +#to-do, remove missing .po support when writerfilter .po files exist $(call gb_MoTarget_get_target,%) : \ $(gb_Helper_MISCDUMMY) \ $(call gb_ExternalExecutable_get_dependencies,python) $(call gb_Output_announce,$*,$(true),MO,2) -# after translate should look like this -# $(call gb_Helper_abbreviate_dirs,\ -# mkdir -p $(dir $@) && \ -# $(MSGUNIQ) $(gb_POLOCATION)/$(LANGUAGE)/$(POLOCATION)/messages.po | $(MSGFMT) - -o $@) $(call gb_Helper_abbreviate_dirs,\ mkdir -p $(dir $@) && \ - $(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/solenv/bin/interim-update-module-for-gettext $(gb_POLOCATION)/$(LANGUAGE)/$(POLOCATION) $@.po && \ - $(MSGUNIQ) --force-po $@.po | $(MSGFMT) - -o $@) + if test -e $(gb_POLOCATION)/$(LANGUAGE)/$(POLOCATION)/messages.po; then \ + $(MSGUNIQ) --force-po $(gb_POLOCATION)/$(LANGUAGE)/$(POLOCATION)/messages.po | $(MSGFMT) - -o $@; \ + else \ + echo missing $(gb_POLOCATION)/$(LANGUAGE)/$(POLOCATION)/messages.po && \ + $(MSGUNIQ) --force-po $(SRCDIR)/solenv/bin/dummy.po | $(MSGFMT) - -o $@; \ + fi) #$(info $(call gb_MoTarget_get_target,$(1))) define gb_MoTarget_MoTarget |