summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config_host/config_liblangtag.h.in1
-rw-r--r--configure.ac1
-rw-r--r--i18nlangtag/CppunitTest_i18nlangtag_test_languagetag.mk1
-rw-r--r--i18nlangtag/Library_i18nlangtag.mk1
-rw-r--r--i18nlangtag/qa/cppunit/test_languagetag.cxx17
-rw-r--r--i18nlangtag/source/languagetag/languagetag.cxx2
6 files changed, 8 insertions, 15 deletions
diff --git a/config_host/config_liblangtag.h.in b/config_host/config_liblangtag.h.in
index f639fb76c11a..18a9c122276e 100644
--- a/config_host/config_liblangtag.h.in
+++ b/config_host/config_liblangtag.h.in
@@ -1,6 +1,7 @@
#ifndef CONFIG_LIBLANGTAG_H
#define CONFIG_LIBLANGTAG_H
+#define ENABLE_LIBLANGTAG 0
#define LIBLANGTAG_INLINE_FIX 0
#endif
diff --git a/configure.ac b/configure.ac
index e1814edef494..5aed6eb7eb03 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11768,6 +11768,7 @@ if test "$enable_liblangtag" = "yes" -o \
LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/langtag/liblangtag/.libs -llangtag"
fi
fi
+ AC_DEFINE(ENABLE_LIBLANGTAG)
else
AC_MSG_RESULT([no])
fi
diff --git a/i18nlangtag/CppunitTest_i18nlangtag_test_languagetag.mk b/i18nlangtag/CppunitTest_i18nlangtag_test_languagetag.mk
index 849d94bebec8..076f59d51437 100644
--- a/i18nlangtag/CppunitTest_i18nlangtag_test_languagetag.mk
+++ b/i18nlangtag/CppunitTest_i18nlangtag_test_languagetag.mk
@@ -29,7 +29,6 @@ $(eval $(call gb_CppunitTest_use_externals,i18nlangtag_test_languagetag,\
liblangtag \
libxml2 \
))
-$(eval $(call gb_CppunitTest_add_defs,i18nlangtag_test_languagetag,-DENABLE_LIBLANGTAG))
ifneq ($(SYSTEM_LIBLANGTAG),)
$(eval $(call gb_CppunitTest_add_defs,i18nlangtag_test_languagetag,-DSYSTEM_LIBLANGTAG))
diff --git a/i18nlangtag/Library_i18nlangtag.mk b/i18nlangtag/Library_i18nlangtag.mk
index 30b6e012ab12..f493558413df 100644
--- a/i18nlangtag/Library_i18nlangtag.mk
+++ b/i18nlangtag/Library_i18nlangtag.mk
@@ -36,7 +36,6 @@ $(eval $(call gb_Library_add_exception_objects,i18nlangtag,\
ifeq ($(ENABLE_LIBLANGTAG),TRUE)
-$(eval $(call gb_Library_add_defs,i18nlangtag,-DENABLE_LIBLANGTAG))
$(eval $(call gb_Library_use_external,i18nlangtag,liblangtag))
$(eval $(call gb_Library_use_external,i18nlangtag,libxml2))
$(eval $(call gb_Library_use_system_win32_libs,i18nlangtag,\
diff --git a/i18nlangtag/qa/cppunit/test_languagetag.cxx b/i18nlangtag/qa/cppunit/test_languagetag.cxx
index f93f1df53f7d..76ef5a36fa05 100644
--- a/i18nlangtag/qa/cppunit/test_languagetag.cxx
+++ b/i18nlangtag/qa/cppunit/test_languagetag.cxx
@@ -17,6 +17,7 @@
#include <i18nlangtag/mslangid.hxx>
#include <i18nlangtag/languagetag.hxx>
+#include <config_liblangtag.h>
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include <osl/file.hxx>
@@ -25,14 +26,6 @@
using namespace com::sun::star;
-// To test the replacement code add '&& 0' and also in
-// source/languagetag/languagetag.cxx
-#if defined(ENABLE_LIBLANGTAG)
-#define USE_LIBLANGTAG 1
-#else
-#define USE_LIBLANGTAG 0
-#endif
-
namespace {
class TestLanguageTag : public CppUnit::TestFixture
@@ -58,7 +51,7 @@ void TestLanguageTag::testAllTags()
OUString aBcp47 = de_DE.getBcp47();
lang::Locale aLocale = de_DE.getLocale();
LanguageType nLanguageType = de_DE.getLanguageType();
-#if USE_LIBLANGTAG
+#if ENABLE_LIBLANGTAG
CPPUNIT_ASSERT_MESSAGE("Default script should be stripped after canonicalize.", aBcp47 == "de-DE" );
CPPUNIT_ASSERT( aLocale.Language == "de" );
CPPUNIT_ASSERT( aLocale.Country == "DE" );
@@ -87,7 +80,7 @@ void TestLanguageTag::testAllTags()
OUString s_klingon( "i-klingon" );
LanguageTag klingon( s_klingon, true );
lang::Locale aLocale = klingon.getLocale();
-#if USE_LIBLANGTAG
+#if ENABLE_LIBLANGTAG
CPPUNIT_ASSERT( klingon.getBcp47() == "tlh" );
CPPUNIT_ASSERT( aLocale.Language == "tlh" );
CPPUNIT_ASSERT( aLocale.Country.isEmpty() );
@@ -469,7 +462,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT( en_GB_oxendict_Fallbacks[4] == "en");
}
-#if USE_LIBLANGTAG
+#if ENABLE_LIBLANGTAG
// 'zh-yue-HK' uses redundant 'zh-yue' and should be preferred 'yue-HK'
#if 0
/* XXX Disabled because liblangtag in lt_tag_canonicalize() after replacing
@@ -623,7 +616,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "en-US", &aCanonicalized, true) && aCanonicalized == "en-US" );
CPPUNIT_ASSERT( !LanguageTag::isValidBcp47( "x-foobar", &aCanonicalized, true) && aCanonicalized == "x-foobar" );
CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "qaa", &aCanonicalized, true) && aCanonicalized == "qaa" );
-#if USE_LIBLANGTAG
+#if ENABLE_LIBLANGTAG
CPPUNIT_ASSERT( LanguageTag::isValidBcp47( "de-Latn-DE", &aCanonicalized) && aCanonicalized == "de-DE" );
/* TODO: at least some (those we know) grandfathered tags should be
* recognized by the replacement code. */
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index de31afeb84db..0262a3670402 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -24,7 +24,7 @@
//#define erDEBUG
-#if defined(ENABLE_LIBLANGTAG)
+#if ENABLE_LIBLANGTAG
#if LIBLANGTAG_INLINE_FIX
#define LT_HAVE_INLINE
#endif