Skip to content

[Android] DateTimeFormatter(LocaleID.DEFAULT) always uses English #3834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
itlancer opened this issue May 28, 2025 · 0 comments
Open

[Android] DateTimeFormatter(LocaleID.DEFAULT) always uses English #3834

itlancer opened this issue May 28, 2025 · 0 comments
Labels

Comments

@itlancer
Copy link

itlancer commented May 28, 2025

Problem Description

DateTimeFormatter(LocaleID.DEFAULT) always uses English for Android. Doesn't matter what default system language set up.

Tested with multiple AIR versions, even with latest AIR 51.2.1.4 with multiple different devices, OS versions with different applications.
The same issue in all cases.
There is no such issue with other plaftorms.

Related issues:
https://tracker.adobe.com/#/view/AIR-4198765
#3469
#99
#3091
#3090
#2644

Steps to Reproduce

Launch code below with any Android device with system Spanish locale (or any other non-English).

Application sample with sources attached.
android_date_time_formatter_default_bug.zip

package {
	import flash.display.Sprite;
	import flash.globalization.DateTimeFormatter;
	import flash.globalization.LocaleID;
	import flash.system.Capabilities;
	
	public class AndroidDateTimeFormatterDefaultBug extends Sprite {
		
		public function AndroidDateTimeFormatterDefaultBug() {
			trace(Capabilities.language);
			trace(Capabilities.languages);
			
			var dateTimeFormatter:DateTimeFormatter = new DateTimeFormatter(LocaleID.DEFAULT);
			//var dateTimeFormatter:DateTimeFormatter = new DateTimeFormatter("es-MX");//Workaround
			dateTimeFormatter.setDateTimePattern("dd MMMM EEEE");
			
			var date:Date = new Date();
			trace(dateTimeFormatter.format(date));//This line for Android always return english string using LocaleID.DEFAULT
		}
	}
}

Actual Result:
In traces you will see:

es
es-MX
28 May Wednesday

Expected Result:
In traces you will see:

es
es-MX
28 mayo miércoles

Known Workarounds

Set up locale directly which you can get from Capabilities.languages or Capabilities.language.

@itlancer itlancer added the Bug label May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant