Skip to content

Commit

Permalink
[DatePicker] Localized numbers in month
Browse files Browse the repository at this point in the history
Resolves #1948

PiperOrigin-RevId: 350567674
(cherry picked from commit 3e79942)
  • Loading branch information
ymarian authored and ikim24 committed Jan 14, 2021
1 parent b4b624e commit 206699f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import androidx.annotation.Nullable;
import java.util.Calendar;
import java.util.Collection;
import java.util.Locale;

/**
* Represents the days of a month with {@link TextView} instances for each day.
Expand Down Expand Up @@ -116,7 +117,8 @@ public TextView getView(int position, @Nullable View convertView, @NonNull ViewG
int dayNumber = offsetPosition + 1;
// The tag and text uniquely identify the view within the MaterialCalendar for testing
day.setTag(month);
day.setText(String.valueOf(dayNumber));
Locale locale = day.getResources().getConfiguration().locale;
day.setText(String.format(locale, "%d", dayNumber));
long dayInMillis = month.getDay(dayNumber);
if (month.year == Month.current().year) {
day.setContentDescription(DateStrings.getMonthDayOfWeekDay(dayInMillis));
Expand Down

0 comments on commit 206699f

Please sign in to comment.