diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/language/LanguageUtils.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/language/LanguageUtils.java index bbfd3193a..5adf2352b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/language/LanguageUtils.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/language/LanguageUtils.java @@ -55,6 +55,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.language.impl.RussianTransliter import nodomain.freeyourgadget.gadgetbridge.util.language.impl.ScandinavianTransliterator; import nodomain.freeyourgadget.gadgetbridge.util.language.impl.TurkishTransliterator; import nodomain.freeyourgadget.gadgetbridge.util.language.impl.UkranianTransliterator; +import nodomain.freeyourgadget.gadgetbridge.util.language.impl.GeorgianTransliterator; public class LanguageUtils { private static final Logger LOG = LoggerFactory.getLogger(LanguageUtils.class); @@ -66,6 +67,7 @@ public class LanguageUtils { put("estonian", new EstonianTransliterator()); put("extended_ascii", new ExtendedAsciiTransliterator()); put("french", new FrenchTransliterator()); + put("georgian", new GeorgianTransliterator()); put("german", new GermanTransliterator()); put("greek", new GreekTransliterator()); put("hebrew", new HebrewTransliterator()); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/language/impl/GeorgianTransliterator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/language/impl/GeorgianTransliterator.java new file mode 100644 index 000000000..0af46bdb0 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/language/impl/GeorgianTransliterator.java @@ -0,0 +1,42 @@ +/* Copyright (C) 2017-2022 Andreas Shimokawa, Aniruddha Adhikary, Daniele + Gobbetti, ivanovlev, kalaee, lazarosfs, McSym28, M. Hadi, Roi Greenberg, + Taavi Eomäe, Ted Stein, Thomas, Yaron Shahrabani, José Rebelo + + This file is part of Gadgetbridge. + + Gadgetbridge is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Gadgetbridge is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . */ + package nodomain.freeyourgadget.gadgetbridge.util.language.impl; + + import java.util.HashMap; + + import nodomain.freeyourgadget.gadgetbridge.util.language.SimpleTransliterator; + + public class GeorgianTransliterator extends SimpleTransliterator { + public GeorgianTransliterator() { + super(new HashMap() {{ + put('ა', "a"); put('ბ', "b"); put('გ', "g"); + put('დ', "d"); put('ე', "e"); put('ვ', "v"); + put('ზ', "z"); put('თ', "t"); put('ი', "i"); + put('კ', "k"); put('ლ', "l"); put('მ', "m"); + put('ნ', "n"); put('ო', "o"); put('პ', "p"); + put('ჟ', "J"); put('რ', "r"); put('ს', "s"); + put('ტ', "t"); put('უ', "u"); put('ფ', "f"); + put('ქ', "q"); put('ღ', "R"); put('ყ', "y"); + put('შ', "S"); put('ჩ', "C"); put('ც', "c"); + put('ძ', "Z"); put('წ', "w"); put('ჭ', "W"); + put('ხ', "x"); put('ჯ', "j"); put('ჰ', "h"); + }}); + } + } + \ No newline at end of file diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index cd0701714..1f471be7f 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -2771,6 +2771,7 @@ @string/estonian @string/extended_ascii @string/french + @string/georgian @string/german @string/greek @string/hebrew @@ -2792,6 +2793,7 @@ estonian extended_ascii french + georgian german greek hebrew diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 948eee741..518fa52d4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -911,6 +911,7 @@ Norwegian Bokmål Spanish Russian + Georgian German Bengali Czech diff --git a/app/src/test/java/nodomain/freeyourgadget/gadgetbridge/util/language/LanguageUtilsTest.java b/app/src/test/java/nodomain/freeyourgadget/gadgetbridge/util/language/LanguageUtilsTest.java index ac23f26f1..f1b2ca0fe 100644 --- a/app/src/test/java/nodomain/freeyourgadget/gadgetbridge/util/language/LanguageUtilsTest.java +++ b/app/src/test/java/nodomain/freeyourgadget/gadgetbridge/util/language/LanguageUtilsTest.java @@ -163,6 +163,16 @@ public class LanguageUtilsTest extends TestBase { assertEquals("lithuanian translation failed", expected, output); } + @Test + public void testStringTransliterateGeorgian() { + final Transliterator transliterator = LanguageUtils.getTransliterator("georgian"); + + String input = "ა ბ ტ თ ჟ ყ წ ჭ ჰ"; + String output = transliterator.transliterate(input); + String expected = "a b t T J y w W h"; + assertEquals("georgian transliteration failed", expected, output); + } + @Test public void testTransliterateOption() throws Exception { enableTransliteration(false); @@ -177,7 +187,7 @@ public class LanguageUtilsTest extends TestBase { SharedPreferences devicePrefs = GBApplication.getDeviceSpecificSharedPrefs(dummyGBDevice.getAddress()); SharedPreferences.Editor editor = devicePrefs.edit(); if (enable) { - editor.putString(PREF_TRANSLITERATION_LANGUAGES, "extended_ascii,scandinavian,german,russian,hebrew,greek,ukranian,arabic,persian,lithuanian,polish,estonian,icelandic,czech,turkish,bengali,korean"); + editor.putString(PREF_TRANSLITERATION_LANGUAGES, "extended_ascii,scandinavian,german,russian,hebrew,greek,ukranian,arabic,persian,lithuanian,polish,estonian,icelandic,czech,turkish,bengali,korean,georgian"); } else { editor.remove(PREF_TRANSLITERATION_LANGUAGES); }