[Libreoffice-commits] core.git: 2 commits - i18nlangtag/Executable_localestr.mk i18nlangtag/Module_i18nlangtag.mk i18nlangtag/source Repository.mk solenv/bin solenv/gbuild
Caolán McNamara
caolanm at redhat.com
Fri Jul 21 11:33:44 UTC 2017
Repository.mk | 1
i18nlangtag/Executable_localestr.mk | 29 ---------
i18nlangtag/Module_i18nlangtag.mk | 9 ---
i18nlangtag/source/localestr/localestr.cxx | 20 ------
solenv/bin/interim-update-module-for-gettext | 81 +++++++++++++++++++++++++++
solenv/bin/localestr | 17 +++++
solenv/gbuild/AllLangMoTarget.mk | 21 +++----
7 files changed, 107 insertions(+), 71 deletions(-)
New commits:
commit b51973398deb8c9b4661ad0df54328d64e1fc79a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jul 21 11:54:29 2017 +0100
use old translations for interim period
Change-Id: I81af71041d8d9d0074c9585ced510d7daab07c20
diff --git a/solenv/bin/interim-update-module-for-gettext b/solenv/bin/interim-update-module-for-gettext
new file mode 100755
index 000000000000..0fe222504273
--- /dev/null
+++ b/solenv/bin/interim-update-module-for-gettext
@@ -0,0 +1,81 @@
+#!/usr/bin/python
+
+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 >> sys.stderr, "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 >> sys.stderr, "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)
+else:
+ messages = polib.POFile()
+ messages.metadata = {
+ 'Project-Id-Version': '1.0',
+ 'Report-Msgid-Bugs-To': 'you at example.com',
+ 'POT-Creation-Date': '2007-10-18 14:00+0100',
+ 'PO-Revision-Date': '2007-10-18 14:00+0100',
+ 'Last-Translator': 'you <you at example.com>',
+ 'Language-Team': 'English <yourteam at 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/bin/update-for-gettext b/solenv/bin/update-for-gettext
old mode 100644
new mode 100755
diff --git a/solenv/gbuild/AllLangMoTarget.mk b/solenv/gbuild/AllLangMoTarget.mk
index c5cf2cf1005d..d3953b1163ae 100644
--- a/solenv/gbuild/AllLangMoTarget.mk
+++ b/solenv/gbuild/AllLangMoTarget.mk
@@ -32,15 +32,15 @@ $(call gb_MoTarget_get_clean_target,%) :
$(call gb_MoTarget_get_target,$*) \
$(call gb_MoTarget_get_install_target,$*))
-#for the moment merge existing source and ui translations into a single .po,
-#and minimize msgctxt
-#eventually instead can do something like
-#msgfmt $(gb_POLOCATION)/$(LANGUAGE)/$(LIBRARY)/messages.po -o $@)
$(call gb_MoTarget_get_target,%) : $(gb_Helper_MISCDUMMY)
$(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 $@) && \
- if test -e $(gb_POLOCATION)/$(LANGUAGE)/$(POLOCATION)/messages.po; then $(MSGUNIQ) $(gb_POLOCATION)/$(LANGUAGE)/$(POLOCATION)/messages.po | $(MSGFMT) - -o $@; else touch $@; fi)
+ mkdir -p $(dir $@) && $(SRCDIR)/solenv/bin/interim-update-module-for-gettext $(gb_POLOCATION)/$(LANGUAGE)/$(POLOCATION) $@.po && \
+ $(MSGUNIQ) --force-po $@.po | $(MSGFMT) - -o $@)
#$(info $(call gb_MoTarget_get_target,$(1)))
define gb_MoTarget_MoTarget
commit 8b11c3e8443ab7d0ba5f4fdc754dcdc8c2ca07be
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jul 21 11:11:28 2017 +0100
replace localestr with a script for the supported translation targets
Change-Id: Ia0c00f6f978428d68b3c53051e26e1913b207dbe
diff --git a/Repository.mk b/Repository.mk
index c4d89a7c19f0..85388801b5f2 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -42,7 +42,6 @@ $(eval $(call gb_Helper_register_executables,NONE, \
libtest \
lngconvex \
localize \
- localestr \
makedepend \
mbsdiff \
mork_helper \
diff --git a/i18nlangtag/Executable_localestr.mk b/i18nlangtag/Executable_localestr.mk
deleted file mode 100644
index 99195ffc7b80..000000000000
--- a/i18nlangtag/Executable_localestr.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-$(eval $(call gb_Executable_Executable,localestr))
-
-$(eval $(call gb_Executable_use_api,localestr,\
- offapi \
- udkapi \
-))
-
-$(eval $(call gb_Executable_use_external,localestr,liblangtag))
-
-$(eval $(call gb_Executable_use_libraries,localestr,\
- i18nlangtag \
- sal \
-))
-
-$(eval $(call gb_Executable_add_exception_objects,localestr,\
- i18nlangtag/source/localestr/localestr \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/i18nlangtag/Module_i18nlangtag.mk b/i18nlangtag/Module_i18nlangtag.mk
index a58f8f9bc608..edd2e1d2e2a9 100644
--- a/i18nlangtag/Module_i18nlangtag.mk
+++ b/i18nlangtag/Module_i18nlangtag.mk
@@ -12,15 +12,6 @@ $(eval $(call gb_Module_add_targets,i18nlangtag,\
Library_i18nlangtag \
))
-ifeq ($(CROSS_COMPILING),)
-
-$(eval $(call gb_Module_add_targets,i18nlangtag,\
- Executable_localestr \
-))
-
-endif
-
-
$(eval $(call gb_Module_add_check_targets,i18nlangtag,\
CppunitTest_i18nlangtag_test_languagetag \
))
diff --git a/i18nlangtag/source/localestr/localestr.cxx b/i18nlangtag/source/localestr/localestr.cxx
deleted file mode 100644
index c18531330c51..000000000000
--- a/i18nlangtag/source/localestr/localestr.cxx
+++ /dev/null
@@ -1,20 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-#include <i18nlangtag/languagetag.hxx>
-#include <stdio.h>
-
-int main(int /*argc*/, char **argv)
-{
- LanguageTag aTag(OUString::createFromAscii(argv[1]));
- OUString aLocaleStr = aTag.getGlibcLocaleString("");
- printf("%s", aLocaleStr.toUtf8().getStr());
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/solenv/bin/localestr b/solenv/bin/localestr
new file mode 100755
index 000000000000..07eab968b908
--- /dev/null
+++ b/solenv/bin/localestr
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+case "$1" in
+ ca-valencia)
+ echo ca at valencia
+ ;;
+ kmr-Latn)
+ echo kmr at latin
+ ;;
+ sr-Latn)
+ echo sr at latin
+ ;;
+ *)
+ echo $1 | tr '-' '_'
+ ;;
+esac
+
diff --git a/solenv/gbuild/AllLangMoTarget.mk b/solenv/gbuild/AllLangMoTarget.mk
index 9772e8c8d1e6..c5cf2cf1005d 100644
--- a/solenv/gbuild/AllLangMoTarget.mk
+++ b/solenv/gbuild/AllLangMoTarget.mk
@@ -23,9 +23,6 @@
# AllLangMoTarget nothing MoTarget for all active langs
# MoTarget running msgfmt
-gb_MoTarget_LOCALESTRDEPS := $(call gb_Executable_get_runtime_dependencies,localestr)
-gb_MoTarget_LOCALESTRCOMMAND := $(call gb_Executable_get_command,localestr)
-
# MoTarget
$(call gb_MoTarget_get_clean_target,%) :
@@ -39,7 +36,7 @@ $(call gb_MoTarget_get_clean_target,%) :
#and minimize msgctxt
#eventually instead can do something like
#msgfmt $(gb_POLOCATION)/$(LANGUAGE)/$(LIBRARY)/messages.po -o $@)
-$(call gb_MoTarget_get_target,%) : $(gb_Helper_MISCDUMMY) $(gb_MoTarget_LOCALESTRDEPS)
+$(call gb_MoTarget_get_target,%) : $(gb_Helper_MISCDUMMY)
$(call gb_Output_announce,$*,$(true),MO,2)
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $@) && \
@@ -71,7 +68,7 @@ $(call gb_AllLangMoTarget_get_clean_target,%) :
$(call gb_Helper_abbreviate_dirs,\
rm -f $(call gb_AllLangMoTarget_get_target,$*))
-$(call gb_AllLangMoTarget_get_target,%) : $(gb_MoTarget_LOCALESTRDEPS)
+$(call gb_AllLangMoTarget_get_target,%) :
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $@) && touch $@)
@@ -87,7 +84,7 @@ $(foreach lang,$(gb_AllLangMoTarget_LANGS),\
$(foreach lang,$(gb_AllLangMoTarget_LANGS),\
$(call gb_Helper_install,$(call gb_AllLangMoTarget_get_target,$(1)), \
- $(call gb_MoTarget_get_install_target,$(shell $(SRCDIR)/bin/run localestr $(lang))/LC_MESSAGES/$(1)), \
+ $(call gb_MoTarget_get_install_target,$(shell $(SRCDIR)/solenv/bin/localestr $(lang))/LC_MESSAGES/$(1)), \
$(call gb_MoTarget_get_target,$(1)$(lang))))
$$(eval $$(call gb_Module_register_target,$(call gb_AllLangMoTarget_get_target,$(1)),$(call gb_AllLangMoTarget_get_clean_target,$(1))))
More information about the Libreoffice-commits
mailing list