the main.xml loads now

This commit is contained in:
⍚~Nex
2024-04-02 00:39:53 +02:00
parent aa9af9b052
commit 221d1c8cda
4 changed files with 14 additions and 8 deletions
+2 -2
View File
@@ -4,8 +4,8 @@ import flixel.util.FlxColor;
import flixel.text.FlxText;
class FunkinText extends FlxText {
public function new(X:Float = 0, Y:Float = 0, FieldWidth:Float = 0, ?Text:String, Size:Int = 16, Border:Bool = true) {
super(X, Y, FieldWidth, Text, Size);
public function new(X:Float = 0, Y:Float = 0, FieldWidth:Float = 0, ?Text:String, Size:Int = 16, Border:Bool = true, ?TranslationID:String) {
super(X, Y, FieldWidth, TranslationsUtil.checkTransl(Text, TranslationID), Size);
setFormat(Paths.font("vcr.ttf"), Size, FlxColor.WHITE);
if (Border) {
borderStyle = OUTLINE;
+1 -1
View File
@@ -37,7 +37,7 @@ class Paths
return library != null ? '$library:assets/$library/$file' : 'assets/$file';
public static inline function translationsMain(key:String)
return getPath(key, 'translations');
return getPath('translations/$key');
public static inline function translations(key:String)
return translationsMain('${TranslationsUtil.get_curLanguage()}/$key');
@@ -20,9 +20,9 @@ class TranslationsUtil
public static var transMap(default, null):Map<String, String> = [];
/**
* The default language used inside of the source code (`en` is English in this case).
* The default language used inside of the source code.
*/
public static var DEFAULT_LANGUAGE:String = 'en'; // no inline so psycopathic mods can edit it - Nex
public static var DEFAULT_LANGUAGE:String = 'English'; // no inline so psycopathic mods can edit it - Nex
/**
* Returns the current language.
@@ -48,7 +48,7 @@ class TranslationsUtil
* If `name` is `null`, it's gonna use the current language.
*/
public static function setTransl(?name:String)
transMap = loadLanguage(name == null ? get_curLanguage() : name);
trace(transMap = loadLanguage(name == null ? get_curLanguage() : name));
/**
* This is for checking a translation, `defString` it's just the string that gets returned just in case it won't find the translation OR the current language selected is ``DEFAULT_LANGUAGE``.
@@ -89,8 +89,8 @@ class TranslationsUtil
public static function loadLanguage(name:String):Map<String, String>
{
#if TRANSLATIONS_SUPPORT
var path:String = 'main.xml';
if (!Assets.exists(Paths.translations('$name/$path'), TEXT)) return [];
var path:String = Paths.translationsMain('$name/main.xml');
if (!Assets.exists(path, TEXT)) return [];
var xml:Access = null;
try xml = new Access(Xml.parse(Assets.getText(path)))
@@ -4,6 +4,12 @@ package funkin.options.categories;
class MiscOptions extends OptionsScreen {
public override function new() {
super("Miscellaneous", "Use this menu to reset save data or engine settings.");
var lanArray:Array<String> = TranslationsUtil.translList();
lanArray.push(TranslationsUtil.DEFAULT_LANGUAGE);
add(new ArrayOption(
"Language",
'The language the Engine currently uses (the default one is ${TranslationsUtil.DEFAULT_LANGUAGE}).',
lanArray, lanArray, "language", function(lan:String) TranslationsUtil.setTransl(lan)));
#if UPDATE_CHECKING
add(new Checkbox(
"Enable Nightly Updates",