Search in sources :

Example 1 with L10N

use of net.mcreator.ui.init.L10N in project MCreator by MCreator.

the class ModElementUITest method testModElementsNonDefaultLocale.

// use non-default translation to test translations at the same time
@Test
public void testModElementsNonDefaultLocale() throws Exception {
    long rgenseed = System.currentTimeMillis();
    Random random = new Random(rgenseed);
    LOG.info("Random number generator seed: " + rgenseed);
    PreferencesManager.PREFERENCES.ui.language = L10N.getSupportedLocales().stream().filter(locale -> locale != L10N.DEFAULT_LOCALE).max(Comparator.comparingInt(L10N::getUITextsLocaleSupport)).orElse(null);
    L10N.initTranslations();
    LOG.info("Testing mod element GUI for locale " + PreferencesManager.PREFERENCES.ui.language);
    testModElementLoading(random);
}
Also used : Assertions.fail(org.junit.jupiter.api.Assertions.fail) Generator(net.mcreator.generator.Generator) Random(java.util.Random) TestWorkspaceDataProvider(net.mcreator.integration.TestWorkspaceDataProvider) ArrayList(java.util.ArrayList) GeneratableElement(net.mcreator.element.GeneratableElement) BeforeAll(org.junit.jupiter.api.BeforeAll) PreferencesManager(net.mcreator.preferences.PreferencesManager) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Method(java.lang.reflect.Method) Path(java.nio.file.Path) L10N(net.mcreator.ui.init.L10N) BlocklyPanel(net.mcreator.ui.blockly.BlocklyPanel) GeneratorConfiguration(net.mcreator.generator.GeneratorConfiguration) Files(java.nio.file.Files) TestSetup(net.mcreator.integration.TestSetup) ModElementType(net.mcreator.element.ModElementType) IOException(java.io.IOException) Field(java.lang.reflect.Field) File(java.io.File) Workspace(net.mcreator.workspace.Workspace) InvocationTargetException(java.lang.reflect.InvocationTargetException) MCreator(net.mcreator.ui.MCreator) WorkspaceSettings(net.mcreator.workspace.settings.WorkspaceSettings) Test(org.junit.jupiter.api.Test) List(java.util.List) Logger(org.apache.logging.log4j.Logger) ModElement(net.mcreator.workspace.elements.ModElement) ModElementGUI(net.mcreator.ui.modgui.ModElementGUI) ModElementTypeLoader(net.mcreator.element.ModElementTypeLoader) GeneratorFlavor(net.mcreator.generator.GeneratorFlavor) Comparator(java.util.Comparator) LogManager(org.apache.logging.log4j.LogManager) Random(java.util.Random) Test(org.junit.jupiter.api.Test)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Random (java.util.Random)1 GeneratableElement (net.mcreator.element.GeneratableElement)1 ModElementType (net.mcreator.element.ModElementType)1 ModElementTypeLoader (net.mcreator.element.ModElementTypeLoader)1 Generator (net.mcreator.generator.Generator)1 GeneratorConfiguration (net.mcreator.generator.GeneratorConfiguration)1 GeneratorFlavor (net.mcreator.generator.GeneratorFlavor)1 TestSetup (net.mcreator.integration.TestSetup)1 TestWorkspaceDataProvider (net.mcreator.integration.TestWorkspaceDataProvider)1 PreferencesManager (net.mcreator.preferences.PreferencesManager)1