mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
Add translations for 23 more languages and fill missing strings (#669)
* Add translations for 23 more languages and fill missing strings * Translate the strings added in main into every language Cardboard VR and the session drawer's component downloads in all 31 languages, the game details facts and HowLongToBeat labels in the 23 new ones, and the reworded Components page note there.
This commit is contained in:
1 parent
9a6d48c04b
commit
69e68a5008
45 files changed
+57044
-1053
No files matched your search
@@ -0,0 +1,57 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import java.io.File
|
||||
import java.util.Locale
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class AppLanguageTest {
|
||||
private fun tag(languageTag: String) = AppLanguage.supportedTag(Locale.forLanguageTag(languageTag))
|
||||
|
||||
private val folders = mapOf(
|
||||
"id" to "in", "ms" to "ms", "cs" to "cs", "da" to "da", "de" to "de", "es" to "es",
|
||||
"es-419" to "b+es+419", "fr" to "fr", "it" to "it", "hu" to "hu", "nl" to "nl", "nb" to "nb",
|
||||
"pl" to "pl", "pt-BR" to "pt", "pt-PT" to "pt-rPT", "ro" to "ro", "fi" to "fi", "sv" to "sv",
|
||||
"vi" to "vi", "tr" to "tr", "el" to "el", "bg" to "bg", "ru" to "ru", "uk" to "uk", "ar" to "ar",
|
||||
"hi" to "hi", "th" to "th", "ja" to "ja", "ko" to "ko", "zh-CN" to "zh-rCN", "zh-TW" to "zh-rTW",
|
||||
"zh-HK" to "zh-rHK",
|
||||
)
|
||||
|
||||
@Test fun everyLanguageReadsAsItself() {
|
||||
AppLanguage.supported.forEach { assertEquals(it, tag(it)) }
|
||||
}
|
||||
|
||||
@Test fun everyLanguageHasItsOwnName() {
|
||||
val names = AppLanguage.supported.map(AppLanguage::nativeName)
|
||||
assertEquals(names.size, names.toSet().size)
|
||||
AppLanguage.supported.forEach { assertTrue(it, AppLanguage.nativeName(it) != it) }
|
||||
}
|
||||
|
||||
@Test fun systemLocalesFindTheirLanguage() {
|
||||
assertEquals("es-419", tag("es-MX"))
|
||||
assertEquals("es-419", tag("es-US"))
|
||||
assertEquals("es", tag("es-ES"))
|
||||
assertEquals("pt-BR", tag("pt-BR"))
|
||||
assertEquals("pt-BR", tag("pt"))
|
||||
assertEquals("pt-PT", tag("pt-PT"))
|
||||
assertEquals("pt-PT", tag("pt-AO"))
|
||||
assertEquals("id", tag("in-ID"))
|
||||
assertEquals("id", tag("id-ID"))
|
||||
assertEquals("de", tag("de-AT"))
|
||||
assertEquals("ar", tag("ar-EG"))
|
||||
assertEquals("zh-HK", tag("zh-MO"))
|
||||
assertNull(tag("sw-KE"))
|
||||
assertNull(tag("nn-NO"))
|
||||
}
|
||||
|
||||
@Test fun everyLanguageShipsStringsAndIsOfferedToAndroid() {
|
||||
assertEquals(AppLanguage.supported.toSet() - "en", folders.keys)
|
||||
val res = File("src/main/res")
|
||||
folders.values.forEach { assertTrue(it, File(res, "values-$it/strings.xml").isFile) }
|
||||
val config = File(res, "xml/locales_config.xml").readText()
|
||||
val offered = Regex("""android:name="([^"]+)"""").findAll(config).map { it.groupValues[1] }.toList()
|
||||
assertEquals(AppLanguage.supported, offered)
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,18 @@ class SteamLanguageTest {
|
||||
assertEquals("tchinese", steam("zh-HK"))
|
||||
}
|
||||
|
||||
@Test fun everyAppLanguageButHindiHasSteamsOwn() {
|
||||
com.droiddeck.launcher.core.AppLanguage.supported.forEach {
|
||||
val steam = steam(it)
|
||||
assertTrue("$it -> $steam", (steam == "english") == (it == "en" || it == "hi"))
|
||||
}
|
||||
assertEquals("brazilian", steam("pt-BR"))
|
||||
assertEquals("portuguese", steam("pt-PT"))
|
||||
assertEquals("latam", steam("es-419"))
|
||||
assertEquals("indonesian", steam("id"))
|
||||
assertEquals("malay", steam("ms"))
|
||||
}
|
||||
|
||||
@Test fun chineseFollowsTheScriptBeforeTheRegion() {
|
||||
assertEquals("tchinese", steam("zh-Hant-CN"))
|
||||
assertEquals("schinese", steam("zh-Hans-HK"))
|
||||
|
||||
Reference in new issue
Block a user