Bug 1884390 - Adjust Unsupported Error in Translations
This patch: * Adds an option in `LocaleUtils` to fetch language names for a given locale. * Adjusts Translations Unsupported Error to use this option.fenix/125.0
parent
b71a480808
commit
98a4678305
@ -0,0 +1,32 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.fenix.utils
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
|
||||
import java.util.Locale
|
||||
|
||||
@RunWith(FenixRobolectricTestRunner::class)
|
||||
class LocaleUtilsTest {
|
||||
|
||||
@Test
|
||||
fun `WHEN using getDisplayName on a 'de' locale THEN get the expected default name`() {
|
||||
val localizedLanguageName = LocaleUtils.getDisplayName(
|
||||
locale = Locale("de"),
|
||||
)
|
||||
assertEquals("Deutsch", localizedLanguageName)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `WHEN using getLocalizedDisplayName with an 'en' locale on a 'de' locale THEN get the expected localized name`() {
|
||||
val localizedLanguageName = LocaleUtils.getLocalizedDisplayName(
|
||||
userLocale = Locale("en"),
|
||||
languageLocale = Locale("de"),
|
||||
)
|
||||
assertEquals("German", localizedLanguageName)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue