summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorRobert M Campbell <robert.rcampbell@gmail.com>2013-11-13 23:15:13 +0700
committerCaolán McNamara <caolanm@redhat.com>2013-11-13 16:25:58 +0000
commitf24fa8efad247bdc296e4724b914f73f01ef2d0b (patch)
treecda1c5f3afe9a371036801ad3f947ccab70ffbbd /i18npool
parentdebe0835cad25931a934eb3e1f205d508e6498cd (diff)
Add Lao breakiterator support for selecting and counting Lao words.
Change-Id: I6da721dc25394dfee12e3028aefbf0546d1be984 Reviewed-on: https://gerrit.libreoffice.org/6669 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/qa/cppunit/test_breakiterator.cxx25
-rw-r--r--i18npool/source/breakiterator/breakiterator_unicode.cxx2
2 files changed, 26 insertions, 1 deletions
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx
index 8d702501899a..a81475bc8896 100644
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
@@ -39,6 +39,7 @@ public:
void testWeak();
void testAsian();
void testThai();
+ void testLao();
#ifdef TODO
void testNorthernThai();
#endif
@@ -59,6 +60,9 @@ public:
#if (U_ICU_VERSION_MAJOR_NUM > 4)
CPPUNIT_TEST(testKhmer);
#endif
+#if (U_ICU_VERSION_MAJOR_NUM > 51)
+ CPPUNIT_TEST(testLao);
+#endif
CPPUNIT_TEST(testJapanese);
CPPUNIT_TEST_SUITE_END();
private:
@@ -784,6 +788,27 @@ void TestBreakIterator::testAsian()
}
}
+//A test to ensure that our Lao word boundary detection is useful
+void TestBreakIterator::testLao()
+{
+ lang::Locale aLocale;
+ aLocale.Language = OUString("lo");
+ aLocale.Country = OUString("LA");
+ //ຍິນດີຕ້ອນຮັບ
+ const sal_Unicode LAO[] = { 0x0e8d, 0x0eb4, 0x0e99, 0x0e94, 0x0eb5, 0x0e95, 0x0ec9, 0x0ead, 0x0e99, 0x0eae, 0x0eb1, 0x0e9a };
+ OUString aTest(LAO, SAL_N_ELEMENTS(LAO));
+ i18n::Boundary aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale,
+ i18n::WordType::DICTIONARY_WORD, true);
+
+ CPPUNIT_ASSERT(aBounds.startPos == 0 && aBounds.endPos == 5);
+
+ aBounds = m_xBreak->getWordBoundary(aTest, aBounds.endPos, aLocale,
+ i18n::WordType::DICTIONARY_WORD, true);
+
+ CPPUNIT_ASSERT(aBounds.startPos == 5 && aBounds.endPos == 9);
+
+}
+
//A test to ensure that our thai word boundary detection is useful
void TestBreakIterator::testThai()
{
diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx
index f85c1099ea88..3bb2e3ef7c54 100644
--- a/i18npool/source/breakiterator/breakiterator_unicode.cxx
+++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx
@@ -121,7 +121,7 @@ void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const com::sun::star::
OUStringToOString(breakRules[breakType], RTL_TEXTENCODING_ASCII_US).getStr(), &status), status);
}
//use icu's breakiterator for Thai, Khmer, Tibetan and Dzongkha
- else if (rLocale.Language != "th" && rLocale.Language != "km" && rLocale.Language != "bo" && rLocale.Language != "dz")
+ else if (rLocale.Language != "th" && rLocale.Language != "lo" && rLocale.Language != "km" && rLocale.Language != "bo" && rLocale.Language != "dz")
{
status = U_ZERO_ERROR;
OStringBuffer aUDName(64);