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

Add Georgian Transliteration

This commit is contained in:
roolx 2023-02-08 16:11:22 +04:00 committed by Gitea
parent 42f9e63f8e
commit 11bcaeb7a8
5 changed files with 58 additions and 1 deletions

View File

@ -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.ScandinavianTransliterator;
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.TurkishTransliterator; import nodomain.freeyourgadget.gadgetbridge.util.language.impl.TurkishTransliterator;
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.UkranianTransliterator; import nodomain.freeyourgadget.gadgetbridge.util.language.impl.UkranianTransliterator;
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.GeorgianTransliterator;
public class LanguageUtils { public class LanguageUtils {
private static final Logger LOG = LoggerFactory.getLogger(LanguageUtils.class); private static final Logger LOG = LoggerFactory.getLogger(LanguageUtils.class);
@ -66,6 +67,7 @@ public class LanguageUtils {
put("estonian", new EstonianTransliterator()); put("estonian", new EstonianTransliterator());
put("extended_ascii", new ExtendedAsciiTransliterator()); put("extended_ascii", new ExtendedAsciiTransliterator());
put("french", new FrenchTransliterator()); put("french", new FrenchTransliterator());
put("georgian", new GeorgianTransliterator());
put("german", new GermanTransliterator()); put("german", new GermanTransliterator());
put("greek", new GreekTransliterator()); put("greek", new GreekTransliterator());
put("hebrew", new HebrewTransliterator()); put("hebrew", new HebrewTransliterator());

View File

@ -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 <http://www.gnu.org/licenses/>. */
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<Character, String>() {{
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");
}});
}
}

View File

@ -2771,6 +2771,7 @@
<item>@string/estonian</item> <item>@string/estonian</item>
<item>@string/extended_ascii</item> <item>@string/extended_ascii</item>
<item>@string/french</item> <item>@string/french</item>
<item>@string/georgian</item>
<item>@string/german</item> <item>@string/german</item>
<item>@string/greek</item> <item>@string/greek</item>
<item>@string/hebrew</item> <item>@string/hebrew</item>
@ -2792,6 +2793,7 @@
<item>estonian</item> <item>estonian</item>
<item>extended_ascii</item> <item>extended_ascii</item>
<item>french</item> <item>french</item>
<item>georgian</item>
<item>german</item> <item>german</item>
<item>greek</item> <item>greek</item>
<item>hebrew</item> <item>hebrew</item>

View File

@ -911,6 +911,7 @@
<string name="norwegian_bokmal">Norwegian Bokmål</string> <string name="norwegian_bokmal">Norwegian Bokmål</string>
<string name="spanish">Spanish</string> <string name="spanish">Spanish</string>
<string name="russian">Russian</string> <string name="russian">Russian</string>
<string name="georgian">Georgian</string>
<string name="german">German</string> <string name="german">German</string>
<string name="bengali">Bengali</string> <string name="bengali">Bengali</string>
<string name="czech">Czech</string> <string name="czech">Czech</string>

View File

@ -163,6 +163,16 @@ public class LanguageUtilsTest extends TestBase {
assertEquals("lithuanian translation failed", expected, output); 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 @Test
public void testTransliterateOption() throws Exception { public void testTransliterateOption() throws Exception {
enableTransliteration(false); enableTransliteration(false);
@ -177,7 +187,7 @@ public class LanguageUtilsTest extends TestBase {
SharedPreferences devicePrefs = GBApplication.getDeviceSpecificSharedPrefs(dummyGBDevice.getAddress()); SharedPreferences devicePrefs = GBApplication.getDeviceSpecificSharedPrefs(dummyGBDevice.getAddress());
SharedPreferences.Editor editor = devicePrefs.edit(); SharedPreferences.Editor editor = devicePrefs.edit();
if (enable) { 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 { } else {
editor.remove(PREF_TRANSLITERATION_LANGUAGES); editor.remove(PREF_TRANSLITERATION_LANGUAGES);
} }