Commit 1c0736d7 authored by Michael Kamensky's avatar Michael Kamensky

Merge branch 'android-language-selector' into 'master'

Android: Add Language selector in Settings

See merge request core-developers/forge!1984
parents c48b1ea2 198cb4f9
package forge.assets;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import forge.model.FModel;
import java.util.ArrayList;
import java.util.List;
public class FLanguage {
public static void changeLanguage(final String languageName) {
final ForgePreferences prefs = FModel.getPreferences();
if (languageName.equals(prefs.getPref(FPref.UI_LANGUAGE))) { return; }
//save language preference
prefs.setPref(FPref.UI_LANGUAGE, languageName);;
* Gets the languages.
* @return the languages
public static Iterable<String> getAllLanguages() {
final List<String> allLanguages = new ArrayList<String>();
final FileHandle dir = Gdx.files.absolute(ForgeConstants.LANG_DIR);
for (FileHandle languageFile : dir.list()) {
String languageName =;
if (!languageName.endsWith(".properties")) { continue; }
allLanguages.add(languageName.replace(".properties", ""));
return allLanguages;
......@@ -6,6 +6,7 @@ import forge.Graphics;
import forge.MulliganDefs;
import forge.StaticData;
import forge.assets.FLanguage;
import forge.assets.FSkin;
import forge.assets.FSkinColor;
import forge.assets.FSkinFont;
......@@ -48,6 +49,14 @@ public class SettingsPage extends TabPage<SettingsScreen> {
lstSettings.addGroup("Sound Options");
//General Settings
lstSettings.addItem(new CustomSelectSetting(FPref.UI_LANGUAGE, "Language",
"Select Language (Excluded Game part. Still a work in progress) (RESTART REQUIRED)",
FLanguage.getAllLanguages()) {
public void valueChanged(String newValue) {
}, 0);
lstSettings.addItem(new CustomSelectSetting(FPref.UI_SKIN, "Theme",
"Sets the theme that determines how display components are skinned.",
FSkin.getAllSkins()) {
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment