Ten seconds to make flex DateField component speak Russian.

Sometimes I hate flex. Sometimes I love it. For example you need no time to translate DateField component to Russian. What I need is Russian date format, week starts at Monday and labels translated to Russian. Here you are:

  1. <mx:DateField formatString="DD.MM.YYYY"
  2. dayNames="['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб']"
  3. firstDayOfWeek="1"
  4. monthNames="['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь','Декабрь']"/>

As far as translation is needed in every place in project it's better to make subclass:

  1. package fbrg
  2. {
  3. import mx.controls.DateField;
  4.  
  5. public class DateFieldRus extends DateField
  6. {
  7. public function DateFieldRus()
  8. {
  9. super();
  10. this.formatString = "DD.MM.YYYY";
  11. this.dayNames = ['Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'];
  12. this.firstDayOfWeek=1;
  13. this.monthNames=['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь','Декабрь'];
  14. }
  15. }
  16. }

Comments

Post new comment

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.