Internationalization Flashcards

(34 cards)

1
Q

What is Locale in Java?

A

A Locale is an object that represents a specific geographical, cultural, or regional setting.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the purpose of Locale?

A

It enables locale-sensitive operations like formatting dates, numbers, currency, and text.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which package contains Locale class?

A

java.util.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why is Locale important?

A

It allows programs to adapt output according to regional language and formatting rules.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Example of Locale usage?

A

Formatting currency differently for US vs France.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you create a Locale object?

A

new Locale(“en”,”US”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What do Locale parameters represent?

A

Language code and country code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Example language codes?

A

en (English), fr (French), ar (Arabic).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Example country codes?

A

US, FR, DE, IN.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Can Locale affect date formatting?

A

Yes. Date formats change based on region conventions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Can Locale affect number formatting?

A

Yes. Decimal separators and grouping vary by region.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is default Locale?

A

The system’s regional setting used when none is specified.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you get default Locale?

A

Locale.getDefault();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Can you change default Locale?

A

Yes. Using Locale.setDefault().

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Does Locale translate text automatically?

A

No. It provides rules; translation requires resource bundles.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What Java feature works with Locale for translations?

A

ResourceBundle.

17
Q

Real-world example?

A

$1,000.50 (US) vs 1.000,50 € (Germany).

18
Q

Key rule to remember?

A

Locale = region rules for formatting and cultural conventions.

19
Q

How do you use a specific Locale in Java?

A

You create or specify a Locale object and pass it to locale-sensitive classes like formatting or resource utilities.

20
Q

How do you create a specific Locale?

A

Using new Locale(“language”,”COUNTRY”) or predefined constants like Locale.US.

21
Q

Example of creating Locale for UK?

A

Locale uk = Locale.UK;

22
Q

How do you apply a Locale to formatting?

A

Pass it to formatter classes like NumberFormat.getInstance(locale).

23
Q

How do you load localized resources using Locale?

A

Use ResourceBundle.getBundle(“BaseName”, locale).

24
Q

Correct example of loading bundle?

A

ResourceBundle.getBundle(“Messages”, Locale.UK);

25
What does ResourceBundle do with Locale?
It loads region-specific resource files matching that locale.
26
What happens if exact Locale file is missing?
Java falls back to closest matching locale or default.
27
Can Locale be changed globally?
Yes. Using Locale.setDefault(locale).
28
When should you set default Locale?
When your entire application should follow a specific regional setting.
29
Can Locale affect text translation?
Yes, when used with resource bundles.
30
Does Locale automatically translate strings?
No. It selects correct localized resources.
31
Can you specify Locale in date formatting?
Yes. DateFormat.getDateInstance(style, locale).
32
Is Locale limited to language only?
No. It represents language, country, and optional variant.
33
Why use predefined Locale constants?
They reduce errors and improve readability.
34
Key rule to remember?
Create Locale → pass it to APIs that support localization.