mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 10:05:49 +01:00
Add Latvian transliteration
This commit is contained in:
parent
26e6d7469f
commit
98df2d1837
@ -1135,7 +1135,7 @@ public class GBApplication extends Application {
|
|||||||
|
|
||||||
if (oldVersion < 16) {
|
if (oldVersion < 16) {
|
||||||
// If transliteration was enabled for a device, migrate it to the per-language setting
|
// If transliteration was enabled for a device, migrate it to the per-language setting
|
||||||
final String defaultLanguagesIfEnabled = "extended_ascii,scandinavian,german,russian,hebrew,greek,ukranian,arabic,persian,lithuanian,polish,estonian,icelandic,czech,turkish,bengali,korean";
|
final String defaultLanguagesIfEnabled = "extended_ascii,scandinavian,german,russian,hebrew,greek,ukranian,arabic,persian,latvian,lithuanian,polish,estonian,icelandic,czech,turkish,bengali,korean";
|
||||||
try (DBHandler db = acquireDB()) {
|
try (DBHandler db = acquireDB()) {
|
||||||
final DaoSession daoSession = db.getDaoSession();
|
final DaoSession daoSession = db.getDaoSession();
|
||||||
final List<Device> activeDevices = DBHelper.getActiveDevices(daoSession);
|
final List<Device> activeDevices = DBHelper.getActiveDevices(daoSession);
|
||||||
|
@ -48,6 +48,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.language.impl.GreekTransliterat
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.HebrewTransliterator;
|
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.HebrewTransliterator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.IcelandicTransliterator;
|
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.IcelandicTransliterator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.KoreanTransliterator;
|
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.KoreanTransliterator;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.LatvianTransliterator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.LithuanianTransliterator;
|
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.LithuanianTransliterator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.PersianTransliterator;
|
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.PersianTransliterator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.PolishTransliterator;
|
import nodomain.freeyourgadget.gadgetbridge.util.language.impl.PolishTransliterator;
|
||||||
@ -73,6 +74,7 @@ public class LanguageUtils {
|
|||||||
put("hebrew", new HebrewTransliterator());
|
put("hebrew", new HebrewTransliterator());
|
||||||
put("icelandic", new IcelandicTransliterator());
|
put("icelandic", new IcelandicTransliterator());
|
||||||
put("korean", new KoreanTransliterator());
|
put("korean", new KoreanTransliterator());
|
||||||
|
put("latvian", new LatvianTransliterator());
|
||||||
put("lithuanian", new LithuanianTransliterator());
|
put("lithuanian", new LithuanianTransliterator());
|
||||||
put("persian", new PersianTransliterator());
|
put("persian", new PersianTransliterator());
|
||||||
put("polish", new PolishTransliterator());
|
put("polish", new PolishTransliterator());
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
/* Copyright (C) 2017-2023 Andreas Shimokawa, Aniruddha Adhikary, Daniele
|
||||||
|
Gobbetti, ivanovlev, kalaee, lazarosfs, McSym28, M. Hadi, Roi Greenberg,
|
||||||
|
Taavi Eomäe, Ted Stein, Thomas, Yaron Shahrabani, José Rebelo, Davis
|
||||||
|
Mosenkovs
|
||||||
|
|
||||||
|
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 LatvianTransliterator extends SimpleTransliterator {
|
||||||
|
public LatvianTransliterator() {
|
||||||
|
super(new HashMap<Character, String>() {{
|
||||||
|
put('ā', "a"); put('č', "c"); put('ē', "e"); put('ģ', "g"); put('ī', "i"); put('ķ', "k"); put('ļ', "l"); put('ņ', "n"); put('š', "s"); put('ū', "u"); put('ž', "z");
|
||||||
|
put('Ā', "A"); put('Č', "C"); put('Ē', "E"); put('Ģ', "G"); put('Ī', "I"); put('Ķ', "K"); put('Ļ', "L"); put('Ņ', "N"); put('Š', "S"); put('Ū', "U"); put('Ž', "Z");
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
}
|
@ -3081,6 +3081,7 @@
|
|||||||
<item>@string/hebrew</item>
|
<item>@string/hebrew</item>
|
||||||
<item>@string/icelandic</item>
|
<item>@string/icelandic</item>
|
||||||
<item>@string/korean</item>
|
<item>@string/korean</item>
|
||||||
|
<item>@string/latvian</item>
|
||||||
<item>@string/lithuanian</item>
|
<item>@string/lithuanian</item>
|
||||||
<item>@string/persian</item>
|
<item>@string/persian</item>
|
||||||
<item>@string/polish</item>
|
<item>@string/polish</item>
|
||||||
@ -3104,6 +3105,7 @@
|
|||||||
<item>hebrew</item>
|
<item>hebrew</item>
|
||||||
<item>icelandic</item>
|
<item>icelandic</item>
|
||||||
<item>korean</item>
|
<item>korean</item>
|
||||||
|
<item>latvian</item>
|
||||||
<item>lithuanian</item>
|
<item>lithuanian</item>
|
||||||
<item>persian</item>
|
<item>persian</item>
|
||||||
<item>polish</item>
|
<item>polish</item>
|
||||||
|
@ -996,6 +996,7 @@
|
|||||||
<string name="estonian">Estonian</string>
|
<string name="estonian">Estonian</string>
|
||||||
<string name="extended_ascii">Extended ASCII</string>
|
<string name="extended_ascii">Extended ASCII</string>
|
||||||
<string name="icelandic">Icelandic</string>
|
<string name="icelandic">Icelandic</string>
|
||||||
|
<string name="latvian">Latvian</string>
|
||||||
<string name="lithuanian">Lithuanian</string>
|
<string name="lithuanian">Lithuanian</string>
|
||||||
<string name="persian">Persian</string>
|
<string name="persian">Persian</string>
|
||||||
<string name="scandinavian">Scandinavian</string>
|
<string name="scandinavian">Scandinavian</string>
|
||||||
|
@ -149,6 +149,21 @@ public class LanguageUtilsTest extends TestBase {
|
|||||||
assertEquals("Korean transliteration modified a non-Hangul composite", germanExpected, germanActual);
|
assertEquals("Korean transliteration modified a non-Hangul composite", germanExpected, germanActual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStringTransliterateLatvian() {
|
||||||
|
final Transliterator transliterator = LanguageUtils.getTransliterator("latvian");
|
||||||
|
|
||||||
|
String input = "ā č ē ģ ī ķ ļ ņ š ū ž Ā Č Ē Ģ Ī Ķ Ļ Ņ Š Ū Ž";
|
||||||
|
String output = transliterator.transliterate(input);
|
||||||
|
String expected = "a c e g i k l n s u z A C E G I K L N S U Z";
|
||||||
|
assertEquals("latvian translation failed", expected, output);
|
||||||
|
|
||||||
|
input = "aāa cčc eēe gģg iīi kķk lļl nņn sšs uūu zžz AĀA CČC EĒE GĢG IĪI KĶK LĻL NŅN SŠS UŪU ZŽZ";
|
||||||
|
output = transliterator.transliterate(input);
|
||||||
|
expected = "aaa ccc eee ggg iii kkk lll nnn sss uuu zzz AAA CCC EEE GGG III KKK LLL NNN SSS UUU ZZZ";
|
||||||
|
assertEquals("latvian translation failed", expected, output);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStringTransliterateLithuanian() {
|
public void testStringTransliterateLithuanian() {
|
||||||
final Transliterator transliterator = LanguageUtils.getTransliterator("lithuanian");
|
final Transliterator transliterator = LanguageUtils.getTransliterator("lithuanian");
|
||||||
|
Loading…
Reference in New Issue
Block a user