|
@@ -282,18 +282,30 @@ class System {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @:hlNative("std","sys_locale") static function getLocale() : hl.Bytes { return null; }
|
|
|
|
|
|
+ @:hlNative("std","sys_locale") static function sys_locale() : hl.Bytes { return null; }
|
|
|
|
|
|
static var _lang : String;
|
|
static var _lang : String;
|
|
static function get_lang() : String {
|
|
static function get_lang() : String {
|
|
if( _lang == null ) {
|
|
if( _lang == null ) {
|
|
- var str = @:privateAccess Sys.makePath(getLocale());
|
|
|
|
- if( str == null ) str = "en";
|
|
|
|
- _lang = ~/[.@_-]/g.split(str)[0];
|
|
|
|
|
|
+ var str = getLocale();
|
|
|
|
+ _lang = str.split("-").shift();
|
|
}
|
|
}
|
|
return _lang;
|
|
return _lang;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Returns the locale including region code ()
|
|
|
|
+ **/
|
|
|
|
+ static var _loc : String;
|
|
|
|
+ public static function getLocale() {
|
|
|
|
+ if( _loc == null ) {
|
|
|
|
+ var str = @:privateAccess Sys.makePath(sys_locale());
|
|
|
|
+ if( str == null ) str = "en";
|
|
|
|
+ _loc = ~/[.@_]/g.split(str)[0];
|
|
|
|
+ }
|
|
|
|
+ return _loc;
|
|
|
|
+ }
|
|
|
|
+
|
|
// getters
|
|
// getters
|
|
|
|
|
|
#if usesys
|
|
#if usesys
|