replace localestr with a script for the supported translation targets

Change-Id: Ia0c00f6f978428d68b3c53051e26e1913b207dbe
This commit is contained in:
Caolán McNamara 2017-07-21 11:11:28 +01:00
parent 4d1b354235
commit 8b11c3e844
6 changed files with 20 additions and 65 deletions

View file

@ -42,7 +42,6 @@ $(eval $(call gb_Helper_register_executables,NONE, \
libtest \
lngconvex \
localize \
localestr \
makedepend \
mbsdiff \
mork_helper \

View file

@ -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:

View file

@ -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 \
))

View file

@ -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: */

17
solenv/bin/localestr Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
case "$1" in
ca-valencia)
echo ca@valencia
;;
kmr-Latn)
echo kmr@latin
;;
sr-Latn)
echo sr@latin
;;
*)
echo $1 | tr '-' '_'
;;
esac

View file

@ -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))))