-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJEP314AdditionalUnicodeLanguage.java
More file actions
44 lines (36 loc) · 1.5 KB
/
JEP314AdditionalUnicodeLanguage.java
File metadata and controls
44 lines (36 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.ibrahimatay;
import java.text.DateFormat;
import java.time.DayOfWeek;
import java.util.Calendar;
import java.util.Currency;
import java.util.Date;
import java.util.Locale;
public class JEP314AdditionalUnicodeLanguage {
public static void main(String[] args) {
// JEP 314: Additional Unicode Language-Tag Extensions
// https://openjdk.org/jeps/314
/*
ca (calendar) -> gregorian, buddhist, chinese
nu (numbers) -> arab, roman
cu (currency type) -> ISO 4217 currency codes
fw (first day of week) -> sun (Sunday), mon (Monday)
rg (region override) -> uszzzz (US units)
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
tz (time zone) -> uslax (Los Angeles), deber (Berlin)
* */
Locale locale = Locale.forLanguageTag("tr-TR-cu-tr-fw-mon-tz-tr");
Currency currency = Currency.getInstance(locale); // TRY
Calendar calendar = Calendar.getInstance(locale);
DayOfWeek firstDayOfWeek = DayOfWeek.of((calendar.getFirstDayOfWeek() + 5) % 7 + 1);
DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.LONG, locale);
String time = dateFormat.format(new Date());
System.out.println("currency = " + currency);
System.out.println("firstDayOfWeek = " + firstDayOfWeek);
System.out.println("time = " + time);
/*
currency = TRY
firstDayOfWeek = MONDAY
time = 23:37:22 TRT
* */
}
}