mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 10:05:49 +01:00
Added Hebrew transliteration and tests (#571)
This commit is contained in:
parent
58e2538c4e
commit
858eaa6690
@ -20,7 +20,12 @@ public class LanguageUtils {
|
||||
put('п', "p"); put('р', "r"); put('с', "s"); put('т', "t"); put('у', "u"); put('ф', "f"); put('х', "kh"); put('ц', "c");
|
||||
put('ч', "ch");put('ш', "sh");put('щ', "shh");put('ъ', "\"");put('ы', "y"); put('ь', "'"); put('э', "eh"); put('ю', "ju");
|
||||
put('я', "ja");
|
||||
|
||||
|
||||
//hebrew chars
|
||||
put('א', "a"); put('ב', "b"); put('ג', "g"); put('ד', "d"); put('ה', "h"); put('ו', "u"); put('ז', "z"); put('ח', "kh");
|
||||
put('ט', "t"); put('י', "y"); put('כ', "c"); put('ל', "l"); put('מ', "m"); put('נ', "n"); put('ס', "s"); put('ע', "'");
|
||||
put('פ', "p"); put('צ', "ts"); put('ק', "k"); put('ר', "r"); put('ש', "sh"); put('ת', "th"); put('ף', "f"); put('ץ', "ts");
|
||||
put('ך', "ch");put('ם', "m");put('ן', "n");
|
||||
//continue for other languages...
|
||||
}
|
||||
};
|
||||
|
@ -102,7 +102,7 @@ public class DeviceCommunicationServiceTestCase extends TestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransliterationSupport() {
|
||||
public void testTransliterationSupportCyrillic() {
|
||||
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putBoolean("transliteration", true);
|
||||
@ -114,4 +114,18 @@ public class DeviceCommunicationServiceTestCase extends TestBase {
|
||||
|
||||
assertTrue("Transliteration support fail!", result.equals("Prosto tekct"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransliterationSupportHebrew() {
|
||||
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putBoolean("transliteration", true);
|
||||
editor.commit();
|
||||
|
||||
Intent intent = mDeviceService.createIntent().putExtra(EXTRA_NOTIFICATION_BODY, "בדיקה עברית");
|
||||
mDeviceService.invokeService(intent);
|
||||
String result = intent.getStringExtra(EXTRA_NOTIFICATION_BODY);
|
||||
|
||||
assertTrue("Transliteration support fail!", result.equals("bdykh 'vrith"));
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import static org.junit.Assert.assertTrue;
|
||||
*/
|
||||
public class LanguageUtilsTest extends TestBase {
|
||||
@Test
|
||||
public void testStringTransliterate() throws Exception {
|
||||
public void testStringTransliterateCyrillic() throws Exception {
|
||||
//input with cyrillic and diacritic letters
|
||||
String input = "Прõсто текčт";
|
||||
String output = LanguageUtils.transliterate(input);
|
||||
@ -23,6 +23,16 @@ public class LanguageUtilsTest extends TestBase {
|
||||
|
||||
assertTrue(String.format("Transliteration fail! Expected '%s', but found '%s'}", result, output), output.equals(result));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringTransliterateCyrillic() throws Exception {
|
||||
//input with cyrillic and diacritic letters
|
||||
String input = "בדיקה עברית";
|
||||
String output = LanguageUtils.transliterate(input);
|
||||
String result = "bdykh 'brith";
|
||||
|
||||
assertTrue(String.format("Transliteration fail! Expected '%s', but found '%s'}", result, output), output.equals(result));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransliterateOption() throws Exception {
|
||||
|
Loading…
Reference in New Issue
Block a user