diff --git a/android/assets/application/text/application_sk_SK.properties b/android/assets/application/text/application_sk_SK.properties new file mode 100644 index 0000000000000000000000000000000000000000..8c89dbd16385067a6d4ac26c1a92103d8a238eb3 --- /dev/null +++ b/android/assets/application/text/application_sk_SK.properties @@ -0,0 +1,8 @@ +mainmenu_games=Hry +mainmenu_halloffame=SieĹ slávy +mainmenu_statistics=Ĺ tatistiky +mainmenu_encyclopedia=EncyklopĂ©dia +mainmenu_about=O aplikáciĂ +mainmenu_logout=OdhlásiĹĄ + +game_robbery_title=LupiÄŤi diff --git a/android/assets/game/robbery/text/robbery_sk_SK.properties b/android/assets/game/robbery/text/robbery_sk_SK.properties new file mode 100644 index 0000000000000000000000000000000000000000..60015f69797571c8b2287cd652f0a94351468d11 --- /dev/null +++ b/android/assets/game/robbery/text/robbery_sk_SK.properties @@ -0,0 +1,74 @@ + +game_robbery_score=Správne identifikovanĂ˝ch: +game_robbery_averagescore=Priemerne identifikovanĂ˝ch: +game_robbery_loadingtext=Na zaÄŤiatku hry si preÄŤĂtaj pravidlo, podÄľa ktorĂ©ho spoznáš zlodeja. Zapamätaj si ho. Sleduj ÄľudĂ vchádzajĂşcich do banky a dotykom oznaÄŤ zlodejov. +game_robbery_victorytext_threestars=S takouto ostrahou nepotrebuje banka ani trezor. +game_robbery_victorytext_twostar=Tvoje meno si zaÄŤĂnajĂş štebotaĹĄ aj straky na strechách. +game_robbery_victorytext_onestar=Otázka je, ÄŤi ostal trezor poloplnĂ˝ alebo poloprázdnĂ˝. +game_robbery_victorytext_gameover=U lupiÄŤov si rozhodne najobľúbenejšà strážca. Ak budeš trĂ©novaĹĄ, urÄŤite sa ĹĄa budĂş skoro báť. +game_robbery_victorytext_stats=Správne si {0} <b>{1}/{2}</b> návštevnĂkov. +game_robbery_victorytext_stats_identification=identifikoval/a +game_robbery_victorytext_stats_identification_male=identifikoval +game_robbery_victorytext_stats_identification_female=identifikovala +game_robbery_color_red=ÄŤerven +game_robbery_color_green=zelen +game_robbery_color_blue=modr +game_robbery_color_brown=hned +game_robbery_color_grey=siv +game_robbery_color_orange=oranĹľov +game_robbery_color_purple=fialov +game_robbery_color_pink=ruĹľov +game_robbery_color_yellow=Ĺľlt +game_robbery_color_black=ÄŤern +game_robbery_color_white=biel +game_robbery_attribute_topattribute=hornĂ˝ diel obleÄŤenia +game_robbery_attribute_bottomattribute=spodnĂ˝ diel obleÄŤenia +game_robbery_attribute_fpantsattribute=Ă© dámske nohavice +game_robbery_attribute_fskirtattribute=Ăş sukĹu +game_robbery_attribute_mpantsattribute=Ă© pánskĂ© nohavice +game_robbery_attribute_mshortsattribute=Ă© kraĹĄasy +game_robbery_attribute_fhatattribute=Ă˝ dámskĂ˝ klobĂşk +game_robbery_attribute_mhatattribute=Ă˝ pánskĂ˝ klobĂşk +game_robbery_attribute_fshirtattribute=Ăş dámsku košeÄľu +game_robbery_attribute_fsweaterattribute=Ă˝ dámskĂ˝ sveter +game_robbery_attribute_fvestattribute=Ă© dámskĂ© tielko +game_robbery_attribute_fcoatattribute=Ă˝ dámsky kabát +game_robbery_attribute_msweaterattribute=Ă˝ pánsky sveter +game_robbery_attribute_mvestattribute=Ă© pánskĂ© tielko +game_robbery_attribute_mcoatattribute=Ă˝ pánskĂ˝ kabát +game_robbery_attribute_mshirtattribute=Ăş pánsku košeÄľu +game_robbery_attribute_fglassesattribute=dámskĂ© okuliare +game_robbery_attribute_mglassesattribute=pánskĂ© okuliare +game_robbery_attribute_fbraidshairattribute=Ă© vlasy do copu +game_robbery_attribute_flonghairattribute=Ă© dlhĂ© vlasy +game_robbery_attribute_mhairattribute=Ă© krátke vlasy +game_robbery_attribute_fbeadsattribute=Ă© korále +game_robbery_attribute_fscarfattribute=Ă˝ dámska šatka +game_robbery_attribute_mscarfattribute=Ă˝ pánskĂ˝ šál +game_robbery_attribute_mtieattribute=ou kravatu + + +game_robbery_rule_ca0cc0t=Ak prĂde ÄŤlovek, ktorĂ˝ bude maĹĄ na sebe <b>nejakĂ© {0}Ă©</b> obleÄŤenie a\u00A0po Ĺom ÄŤlovek, ktorĂ˝ bude maĹĄ <b>{1}{2}</b>, tak <b>ÄŹalšà v poradĂ je zlodej</b>. +game_robbery_rule_cc0cc0t=Ak prĂde ÄŤlovek, ktorĂ˝ bude maĹĄ <b>{0}{1}</b> a\u00A0<b>po Ĺom</b> ÄŤlovek, ktorĂ˝ bude maĹĄ <b>{2}{3}</b>, tak <b>ÄŹalšà v poradĂ</b> je zlodej. +game_robbery_rule_cccc=Zlodej bude maĹĄ <b>{0}{1}</b> a\u00A0 <b>{2}{3}</b>. +game_robbery_rule_cacc=Zlodej bude maĹĄ na sebe nieÄŤo <b>{0}Ă©ho</b> a\u00A0 bude maĹĄ <b>{1}{2}</b>. +game_robbery_rule_caca=Zlodej bude maĹĄ na sebe nieÄŤo <b>{0}Ă©ho</b> a\u00A0 nieÄŤo <b>{1}Ă©ho</b>. +game_robbery_rule_bx0bx=Zlodej bude maĹĄ <b>rovnakĂ© {0}</b> ako ÄŤlovek, ktorĂ˝ prĂde <b>pred nĂm</b>. +game_robbery_rule_bc1bc=Zlodej bude maĹĄ <b>rovnakĂ© {0}</b> ako ÄŤlovek, ktorĂ˝ prĂde <b>ob\u00A0jednĂ©ho ÄŤloveka pred nĂm</b>. +game_robbery_rule_cc0notcc=Zlodej nebude maĹĄ <b>{0}{1}</b> a\u00A0ÄŤlovek, ktorĂ˝ prĂde <b>pred nĂm</b>, bude maĹĄ na sebe <b>{2}{3}</b>. + +game_robbery_rule_cc1cc=Zlodej bude maĹĄ <b>{0}{1}</b> a\u00A0prĂde <b>ob jednĂ©ho</b> ÄŤloveka po ÄŤloveku, ktorĂ˝ bude maĹĄ <b>{2}{3}</b>. +game_robbery_rule_ca1cc=Zlodej bude maĹĄ <b>{0}{1}</b> a\u00A0ÄŤlovek, ktorĂ˝ prĂde <b>ob jednĂ©ho ÄŤloveka pred nĂm</b>, bude maĹĄ na sebe <b>{2}Ă© obleÄŤenie</b>. +game_robbery_rule_bc2bc=Zlodej bude maĹĄ <b>rovnakĂ© {0}</b> ako ÄŤlovek, kterĂ˝ prĂde <b>ob\u00A0dva ÄľudĂ pred nĂm</b>. +game_robbery_rule_cc1notcc=Zlodej nebude maĹĄ <b>{0}{1}</b> a\u00A0ÄŤlovek, ktorĂ˝ prĂde <b>ob jednĂ©ho</b> ÄŤloveka pred nĂm, bude maĹĄ na sebe <b>{2}{3}</b>. +game_robbery_rule_cc1notca=Zlodej nebude maĹĄ na sebe niÄŤ <b>{0}Ă©ho</b> a\u00A0ÄŤlovek, kterĂ˝ prĂde <b>ob jednoho</b> ÄŤloveka pred nĂm, bude maĹĄ na sebe <b>{1}{2}</b>. +game_robbery_rule_cccccc=Zlodej bude maĹĄ <b>{0}{1}</b>, <b>{2}{3}</b> a\u00A0<b>{4}{5}</b>. + +game_robbery_rule_cc2cc=Zlodej bude maĹĄ <b>{0}{1}</b> a\u00A0prĂde <b>ob dva lidi</b> po ÄŤloveku, kterĂ˝ bude maĹĄ <b>{2}{3}</b>. +game_robbery_rule_cc0notcc0t=Ak prĂde ÄŤlovek, kterĂ˝ bude maĹĄ <b>{0}{1}</b> a\u00A0<b>po Ĺom</b> ÄŤlovek, kterĂ˝ <b>nebude</b> maĹĄ <b>{2}{3}</b>, tak <b>ÄŹalšà v poradĂ</b> je zlodej. +game_robbery_rule_cc0notca0t=Ak prĂde ÄŤlovek, ktorĂ˝ bude maĹĄ <b>{0}{1}</b> a\u00A0<b>po Ĺom</b> ÄŤlovek, ktorĂ˝ <b>nebude</b> maĹĄ niÄŤ <b>{2}Ă©ho</b>, tak <b>ÄŹalšà v poradĂ</b> je zlodej. +game_robbery_rule_cc0cc0cc=Ak prĂde ÄŤlovek, ktorĂ˝ bude maĹĄ <b>{0}{1}</b> a\u00A0<b>po Ĺom</b> ÄŤlovek, kterĂ˝ bude maĹĄ <b>{2}{3}</b>, tak <b>ÄŹalšà v poradĂ</b> je zlodej, ak má na sebe <b>{4}{5}</b>. +game_robbery_rule_ccccnotcc=Zlodej bude maĹĄ <b>{0}{1}</b> a <b>{2}{3}</b> a <b>nebude</b> maĹĄ <b>\u00A0{4}{5}</b>. +game_robbery_rule_bx1bx=Zlodej bude maĹĄ <b>rovnakĂ˝ {0}</b> ako ÄŤlovek, ktorĂ˝ prĂde <b>ob jednĂ©ho ÄŤloveka pred nĂm</b>. + +game_robbery_rulemessage_understand=Rozumiem diff --git a/android/src/cz/nic/tablexia/android/AndroidLauncher.java b/android/src/cz/nic/tablexia/android/AndroidLauncher.java index 0f26cb80a24da72d7ef444e520519a8e5512c875..446a5496e42ae5c1ea5e2a7c7fdb4d2f2bc2534d 100644 --- a/android/src/cz/nic/tablexia/android/AndroidLauncher.java +++ b/android/src/cz/nic/tablexia/android/AndroidLauncher.java @@ -11,6 +11,6 @@ public class AndroidLauncher extends AndroidApplication { protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); - initialize(new Tablexia(BuildConfig.DEBUG), config); + initialize(new Tablexia(BuildConfig.DEBUG, getResources().getConfiguration().locale), config); } } diff --git a/core/src/cz/nic/tablexia/Tablexia.java b/core/src/cz/nic/tablexia/Tablexia.java index 3f6670c58900586e8b83a75a490cb6848d691b6d..e585bb2ea930d9b5c95bd082e109034ce824c083 100644 --- a/core/src/cz/nic/tablexia/Tablexia.java +++ b/core/src/cz/nic/tablexia/Tablexia.java @@ -31,12 +31,12 @@ public class Tablexia extends TablexiaApplication { private boolean loadingComplete = false; - public Tablexia(boolean debug) { - TablexiaSettings.init(debug); + public Tablexia(boolean debug, Locale systemLocale) { + TablexiaSettings.init(debug, systemLocale); } - public Tablexia(String buildVariantKey) { - TablexiaSettings.init(buildVariantKey); + public Tablexia(String buildVariantKey, Locale systemLocale) { + TablexiaSettings.init(buildVariantKey, systemLocale); } private void loadingComplete() { @@ -59,7 +59,10 @@ public class Tablexia extends TablexiaApplication { @Override public void create () { super.create(); - Log.setLoglevel(TablexiaLogLevel.DEBUG); + + TablexiaSettings.getInstance().loadPreferences(); + //TODO set log level for build variant + Log.setLoglevel(TablexiaLogLevel.DEBUG); // init event bus handlers ApplicationBus.getInstance().subscribe(this); @@ -74,7 +77,7 @@ public class Tablexia extends TablexiaApplication { // async loading of remaining application assets ApplicationTextureManager.getInstance().load(); ApplicationFontManager.getInstance().load(); - ApplicationTextManager.getInstance().load(new Locale("cs", "CZ")); + ApplicationTextManager.getInstance().load(TablexiaSettings.getInstance().getLocale()); } @Override diff --git a/core/src/cz/nic/tablexia/TablexiaSettings.java b/core/src/cz/nic/tablexia/TablexiaSettings.java index 9cb32ac2697e296f9e3a674315b9218c542856aa..82fad46811ef858c7fbd0a566782bba4f88f01ba 100644 --- a/core/src/cz/nic/tablexia/TablexiaSettings.java +++ b/core/src/cz/nic/tablexia/TablexiaSettings.java @@ -1,5 +1,10 @@ package cz.nic.tablexia; +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Preferences; + +import java.util.Locale; + import cz.nic.tablexia.util.Log; public class TablexiaSettings { @@ -32,14 +37,62 @@ public class TablexiaSettings { return FALLBACK_VARIANT; } } - - private final BuildVariant BUILD_VARIANT; + + public enum LocaleDefinition { + + SYSTEM (null, "system"), + cs_CZ (new Locale("cs", "CZ"), "cs_CZ"), + sk_SK (new Locale("sk", "SK"), "sk_SK"); + + private final static LocaleDefinition FALLBACK_VARIANT = LocaleDefinition.SYSTEM; + + private final Locale locale; + private final String localeKey; + + private LocaleDefinition(Locale locale, String localeKey) { + this.locale = locale; + this.localeKey = localeKey; + } + + public String getLocaleKey() { + return localeKey; + } + + public Locale getLocale() { + return locale != null ? locale : instance.systemLocale; + } + + public static LocaleDefinition getLocaleDefinitionForKey(String key) { + for(LocaleDefinition localeDefinition: LocaleDefinition.values()) { + if (localeDefinition.localeKey.equals(key)) { + return localeDefinition; + } + } + return FALLBACK_VARIANT; + } + } + + public static final String TABLEXIA_SETTINGS_KEY = "tablexia-"; + public static final String LOCALE_KEY = "locale"; + + private final BuildVariant BUILD_VARIANT; + + private Preferences preferences; + + private Locale systemLocale; + private LocaleDefinition selectedLocale; + + private static final boolean DEBUG_SHOW_BOUNDING_BOXES = true; private static TablexiaSettings instance; - private TablexiaSettings(BuildVariant buildVariant) { - BUILD_VARIANT = buildVariant; + +//////////////////////////// SETTINGS SINGLETON + + private TablexiaSettings(BuildVariant buildVariant, Locale systemLocale) { + BUILD_VARIANT = buildVariant; + this.systemLocale = systemLocale; } public static TablexiaSettings getInstance() { @@ -51,31 +104,50 @@ public class TablexiaSettings { return instance; } - public static void init(boolean debug) { - TablexiaSettings.init(debug ? TablexiaSettings.BuildVariant.DEBUG : TablexiaSettings.BuildVariant.RELEASE); + public static void init(boolean debug, Locale systemLocale) { + TablexiaSettings.init(debug ? TablexiaSettings.BuildVariant.DEBUG : TablexiaSettings.BuildVariant.RELEASE, systemLocale); } - public static void init(String buildVariantKey) { - TablexiaSettings.init(BuildVariant.getBuildVariantForKey(buildVariantKey)); + public static void init(String buildVariantKey, Locale systemLocale) { + TablexiaSettings.init(BuildVariant.getBuildVariantForKey(buildVariantKey), systemLocale); } - public static void init(BuildVariant buildVariant) { + public static void init(BuildVariant buildVariant, Locale systemLocale) { if (instance != null) { String exceptionMessage = "Tablexia setting already initialized!"; Log.err(TablexiaSettings.class, exceptionMessage); throw new IllegalStateException(exceptionMessage); } - instance = new TablexiaSettings(buildVariant); + + instance = new TablexiaSettings(buildVariant, systemLocale); } + + +//////////////////////////// LIBGDX PREFERENCES + + public void loadPreferences() { + preferences = Gdx.app.getPreferences(TABLEXIA_SETTINGS_KEY + BUILD_VARIANT); + selectedLocale = LocaleDefinition.getLocaleDefinitionForKey(preferences.getString(LOCALE_KEY)); + } + + +//////////////////////////// SETTINGS ACCESS public boolean isDebug() { return BUILD_VARIANT.isDebug(); } - - public boolean isShowBoudingBoxes() { - return isDebug() && DEBUG_SHOW_BOUNDING_BOXES; - } - - + public boolean isShowBoudingBoxes() { + return isDebug() && DEBUG_SHOW_BOUNDING_BOXES; + } + + public void setLocale(LocaleDefinition localeDefinition) { + selectedLocale = localeDefinition; + preferences.putString(LOCALE_KEY, localeDefinition.getLocaleKey()); + preferences.flush(); + } + + public Locale getLocale() { + return selectedLocale.getLocale(); + } } diff --git a/core/src/cz/nic/tablexia/loader/ApplicationFontManager.java b/core/src/cz/nic/tablexia/loader/ApplicationFontManager.java index daeaea197003be22935d0245887bf7b934e65041..64731633f6952739d83b9f1942be55712f28ede6 100644 --- a/core/src/cz/nic/tablexia/loader/ApplicationFontManager.java +++ b/core/src/cz/nic/tablexia/loader/ApplicationFontManager.java @@ -18,7 +18,7 @@ import com.badlogic.gdx.graphics.g2d.freetype.FreetypeFontLoader.FreeTypeFontLoa public class ApplicationFontManager extends AssetManager implements IApplicationLoader { private static final int FONT_SIZE = 20; - private static final String CZECH_CHARACTERS = "ěřťůšďžčĹ"; + private static final String CZECH_CHARACTERS = "ěřťůšďžčĹĚōيώČŇ"; private static final String APPLICATION_FONT_PATH = "application/font/"; public static final String FONT_ROBOTO_REGULAR = APPLICATION_FONT_PATH + "Roboto-Regular.ttf"; public static final String FONT_ROBOTO_BOLD = APPLICATION_FONT_PATH + "Roboto-Bold.ttf"; diff --git a/core/src/cz/nic/tablexia/screen/AbstractTablexiaScreen.java b/core/src/cz/nic/tablexia/screen/AbstractTablexiaScreen.java index 9fc9f448a9c30e6374c4c817c040a3be659653fa..fabfe50e64bf0a508342a93b7228739cf00b5241 100644 --- a/core/src/cz/nic/tablexia/screen/AbstractTablexiaScreen.java +++ b/core/src/cz/nic/tablexia/screen/AbstractTablexiaScreen.java @@ -20,6 +20,7 @@ import com.badlogic.gdx.utils.I18NBundle; import com.badlogic.gdx.utils.async.AsyncTask; import com.badlogic.gdx.utils.viewport.ScreenViewport; +import cz.nic.tablexia.TablexiaSettings; import cz.nic.tablexia.bus.ApplicationBus; import cz.nic.tablexia.bus.ApplicationBus.ApplicationEvent; import cz.nic.tablexia.game.loader.AbstractDataManager; @@ -270,7 +271,7 @@ public abstract class AbstractTablexiaScreen<T> extends ScreenAdapter { } private void startTextLoader() { - textManager.load(new Locale("cs", "CZ"), prepareScreenTextResourcesAssetName()); + textManager.load(TablexiaSettings.getInstance().getLocale(), prepareScreenTextResourcesAssetName()); } private void startDataLoader() { diff --git a/desktop/src/cz/nic/tablexia/desktop/DesktopLauncher.java b/desktop/src/cz/nic/tablexia/desktop/DesktopLauncher.java index 7affc378852c0b3b47e39857de96d4590986753f..6064a190dc7358058f73126114990eb89af004e1 100644 --- a/desktop/src/cz/nic/tablexia/desktop/DesktopLauncher.java +++ b/desktop/src/cz/nic/tablexia/desktop/DesktopLauncher.java @@ -4,6 +4,8 @@ import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; import com.jcabi.manifests.Manifests; +import java.util.Locale; + import cz.nic.tablexia.Tablexia; public class DesktopLauncher { @@ -21,6 +23,6 @@ public class DesktopLauncher { config.resizable = false; config.width = 1280; config.height = 800; - new LwjglApplication(new Tablexia(buildVariant), config); + new LwjglApplication(new Tablexia(buildVariant, Locale.getDefault()), config); } } diff --git a/ios/src/cz/nic/tablexia/IOSLauncher.java b/ios/src/cz/nic/tablexia/IOSLauncher.java index c108dd7ea43e24f5b997539ee344286c77f5b3e6..3b23715a26671274e9a4e2267cbac892fef81d5b 100644 --- a/ios/src/cz/nic/tablexia/IOSLauncher.java +++ b/ios/src/cz/nic/tablexia/IOSLauncher.java @@ -5,13 +5,16 @@ import org.robovm.apple.uikit.UIApplication; import com.badlogic.gdx.backends.iosrobovm.IOSApplication; import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration; + +import java.util.Locale; + import cz.nic.tablexia.Tablexia; public class IOSLauncher extends IOSApplication.Delegate { @Override protected IOSApplication createApplication() { IOSApplicationConfiguration config = new IOSApplicationConfiguration(); - return new IOSApplication(new Tablexia(null), config); + return new IOSApplication(new Tablexia(null, Locale.getDefault()), config); } public static void main(String[] argv) {