1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-10 12:09:27 +01:00

Merge pull request #1206 from UncleInf/transliterate_lithuanian

Adding Lithuanian transliteration
This commit is contained in:
Carsten Pfeiffer 2018-08-18 13:08:40 +02:00 committed by GitHub
commit c4411a9c48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -78,6 +78,9 @@ public class LanguageUtils {
// Polish // Polish
put('Ł', "L"); put('ł', "l"); put('Ł', "L"); put('ł', "l");
//Lithuanian
put('ą', "a"); put('č', "c"); put('ę', "e"); put('ė', "e"); put('į', "i"); put('š', "s"); put('ų', "u"); put('ū', "u"); put('ž', "z");
//TODO: these must be configurable. If someone wants to transliterate cyrillic it does not mean his device has no German umlauts //TODO: these must be configurable. If someone wants to transliterate cyrillic it does not mean his device has no German umlauts
//all or nothing is really bad here //all or nothing is really bad here
} }

View File

@ -66,6 +66,19 @@ public class LanguageUtilsTest extends TestBase {
assertEquals("Transliteration failed", result, output); assertEquals("Transliteration failed", result, output);
} }
@Test
public void testStringTransliterateLithuanian() {
String input = "ą č ę ė į š ų ū ž";
String output = LanguageUtils.transliterate(input);
String expected = "a c e e i s u u z";
assertEquals("lithuanian translation failed", expected, output);
input = "aąa cčc eęe eėe iįi sšs uųu uūu zžz";
output = LanguageUtils.transliterate(input);
expected = "aaa ccc eee eee iii sss uuu uuu zzz";
assertEquals("lithuanian translation failed", expected, output);
}
@Test @Test
public void testTransliterateOption() throws Exception { public void testTransliterateOption() throws Exception {
setDefaultTransliteration(); setDefaultTransliteration();