Welcome back.
In this video we'll test the reports in different locales
to make sure the dates appear as we'd expect.
When I run the app and view the reports, the dates are in American format;
month, then day, then year.
That's because the default locale for the emulators
is US, the United States.
I'm in Australia, so let's see what happens when I tell my phone
the correct locale.
Note that locale isn't the same as location.
I happen to be in Australia and I'm also Australian.
If I travel to America, I don't want all my date formats to change
just because I've changed location.
My locale is still Australia even when my location changes.
The locale determines things like date and number formats
and also the language that the phone will use.
We'll see that in a moment.
Okay.
I'll keep the app running and use the home button to return to the home screen.
Then we'll go into settings.
You can change locale from settings. Normally
under an option called languages,
which is in system.
On an android pie emulator,
you go to languages and input and then languages.
At the moment, there's only one language in there,
the default of the United States.
I'll add a new language,
I'll choose English
then Australia.
The default language is still United States.
The phone uses language 1 for its locale,
and all we've done is make swapping languages easier.
While the display is still in English, I'll add a couple of other languages.
I want at least one European language,
mainly because they use different number formats.
Note that languages appear in their own language.
If I want German, that's Deutsch which is German for German.
From there, I'll choose Deutschland which is German for Germany.
Okay. I'll add another. This time, I'll choose a language
that uses a different character set.
They sort at the end of the list.
Scrolling right through the list the very last one is easy to find.
That has a few variants,
so I'll choose the first one and add it to the list of languages.
To make a different language the default, drag it to position one.
I'll start by dragging English Australia to the top of the list.
Before I go back to the task timer app,
I'll make sure the logcat is visible and I'll also clear it.
I'll use the multitasking button to get back to our app. It's still running, remember?
We just switched away from it.
The display is updated automatically.
Changing the language counts as a configuration change
and the activity gets destroyed and recreated.
We can see that happening in the logcat.
All right. That looks good
we've now got the date in day, month and year format.
Again, I'll use the multitasking button to switch back to the settings.
We're still at the language preferences screen,
which is why I'm swapping back and forth this way.
When I change the language to using a completely different character set,
I don't have to worry about getting back here.
All right. I'll drag Deutsch to the top of the list
and switch back to the tasktimer app.
We've now got two digits for the days and the month
and a period used as a separator.
Because we took a bit of extra care
and specified the default locale in our code,
the app looks right in different languages.
All right. I've left the one that uses a different character set till last.
It uses a completely different character set.
And if I get lost trying to change the emulator back to English,
I can just delete the emulator and start again.
If you're using a real phone and don't understand the language,
then be really careful with this next step.
Switch back to settings, and drag number 4 to the top of the list.
Notice how the language preferences heading
is now written using a different character set.
If you close settings at this point, you could struggle to get back here.
This applies to any language that you don't understand,
although ones that use an unfamiliar character set are even harder to navigate.
For that reason, make sure you don't go back from this screen.
I'm in language preferences,
and I'm not going to use the up or back buttons to move back in settings.
If I did do so, getting back here is going to be tricky.
Use the multitasking button to switch to the tasktimer.
The date format is now year, month, day.
That's quite sensible. Dates look much better that way when they're sorted.
We haven't provided translations in whatever language that is,
but at least we're displaying the dates in a format that the user will be used to.
Remember to change your emulator back to a language that you can read
before moving to the next video.
I'm going to add English UK and make that the default
by dragging it to the top of the list.
There's a reason I've chosen English United Kingdom.
The English part is obvious. It's a language I understand.
The reason I've gone for UK is because that format states differently
to the Australian locale.
In the next video,
we'll start to create the ViewModel for our reports.