|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
@@ -98,19 +98,33 @@ private StaticProperty() {}
|
98 | 98 | USER_LANGUAGE = getProperty(props, "user.language", "en");
|
99 | 99 | USER_LANGUAGE_DISPLAY = getProperty(props, "user.language.display", USER_LANGUAGE);
|
100 | 100 | USER_LANGUAGE_FORMAT = getProperty(props, "user.language.format", USER_LANGUAGE);
|
101 |
| - USER_SCRIPT = getProperty(props, "user.script", ""); |
| 101 | + // for compatibility, check for old user.region property |
| 102 | + USER_REGION = getProperty(props, "user.region", ""); |
| 103 | + if (!USER_REGION.isEmpty()) { |
| 104 | + // region can be of form country, country_variant, or _variant |
| 105 | + int i = USER_REGION.indexOf('_'); |
| 106 | + if (i >= 0) { |
| 107 | + USER_COUNTRY = USER_REGION.substring(0, i); |
| 108 | + USER_VARIANT = USER_REGION.substring(i + 1); |
| 109 | + } else { |
| 110 | + USER_COUNTRY = USER_REGION; |
| 111 | + USER_VARIANT = ""; |
| 112 | + } |
| 113 | + USER_SCRIPT = ""; |
| 114 | + } else { |
| 115 | + USER_SCRIPT = getProperty(props, "user.script", ""); |
| 116 | + USER_COUNTRY = getProperty(props, "user.country", ""); |
| 117 | + USER_VARIANT = getProperty(props, "user.variant", ""); |
| 118 | + } |
102 | 119 | USER_SCRIPT_DISPLAY = getProperty(props, "user.script.display", USER_SCRIPT);
|
103 | 120 | USER_SCRIPT_FORMAT = getProperty(props, "user.script.format", USER_SCRIPT);
|
104 |
| - USER_COUNTRY = getProperty(props, "user.country", ""); |
105 | 121 | USER_COUNTRY_DISPLAY = getProperty(props, "user.country.display", USER_COUNTRY);
|
106 | 122 | USER_COUNTRY_FORMAT = getProperty(props, "user.country.format", USER_COUNTRY);
|
107 |
| - USER_VARIANT = getProperty(props, "user.variant", ""); |
108 | 123 | USER_VARIANT_DISPLAY = getProperty(props, "user.variant.display", USER_VARIANT);
|
109 | 124 | USER_VARIANT_FORMAT = getProperty(props, "user.variant.format", USER_VARIANT);
|
110 | 125 | USER_EXTENSIONS = getProperty(props, "user.extensions", "");
|
111 | 126 | USER_EXTENSIONS_DISPLAY = getProperty(props, "user.extensions.display", USER_EXTENSIONS);
|
112 | 127 | USER_EXTENSIONS_FORMAT = getProperty(props, "user.extensions.format", USER_EXTENSIONS);
|
113 |
| - USER_REGION = getProperty(props, "user.region", ""); |
114 | 128 | }
|
115 | 129 |
|
116 | 130 | private static String getProperty(Properties props, String key) {
|
|
0 commit comments