Skip to content

Commit 36f4372

Browse files
committed
avm2: Implement flash.system.Capabilities.language
1 parent 532140d commit 36f4372

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

core/src/avm2/globals/flash/system/Capabilities.as

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ package flash.system {
88
public native static function get screenResolutionY():Number;
99
public native static function get pixelAspectRatio():Number;
1010
public native static function get screenDPI():Number;
11+
public native static function get language(): String;
1112
public static function get manufacturer(): String {
1213
stub_getter("flash.system.Capabilities", "manufacturer");
1314
return "Adobe Windows"
1415
}
15-
public static function get language(): String {
16-
stub_getter("flash.system.Capabilities", "language");
17-
return "en"
18-
}
1916
public static function get isDebugger(): Boolean {
2017
return false
2118
}

core/src/avm2/globals/flash/system/capabilities.rs

+14
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,17 @@ pub fn get_screen_dpi<'gc>(
113113
// source: https://tracker.adobe.com/#/view/FP-3949775
114114
Ok(72.into())
115115
}
116+
117+
/// Implements `flash.system.Capabilities.language`
118+
pub fn get_language<'gc>(
119+
activation: &mut Activation<'_, 'gc>,
120+
_this: Value<'gc>,
121+
_args: &[Value<'gc>],
122+
) -> Result<Value<'gc>, Error<'gc>> {
123+
let language = activation
124+
.context
125+
.system
126+
.language
127+
.get_language_code(activation.context.player_version);
128+
Ok(AvmString::new_utf8(activation.gc(), language).into())
129+
}

0 commit comments

Comments
 (0)