Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Ukrainian Language

How can i convert Date to Ukrainian language dynamically.

I'm using this code:

final SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM, yyyy");
final Date date = calendar.getTime();

final TextView chosenMonth = (TextView) findViewById(R.id.chosenMonth);
chosenMonth.setText(dateFormat.format(date));

To format date as "September, 2013". This text language is Device language, but i need to format this date and display only in Ukrainian language.

I tried to implement this using Locale class but there is no constant for UA language.

like image 240
Procurares Avatar asked Sep 02 '13 18:09

Procurares


1 Answers

Although there is no constant, you can still set the locale yourself if its supported on your device. Refer to this list of supported locales by Android version.

Create your Ukranian Locale with new Locale('uk','UA') and then use it in the version of SimpleDateFormat that takes a Locale.

Would this work?

final SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM, yyyy", new Locale('uk','UA'));
like image 126
Jerry Brady Avatar answered Oct 18 '22 20:10

Jerry Brady