Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbastian committed Jan 22, 2025
1 parent ad49c95 commit 6068376
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 11 deletions.
11 changes: 10 additions & 1 deletion common/dtd/ldml.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -1718,7 +1718,7 @@ CLDR data files are interpreted according to the LDML specification (http://unic
<!ATTLIST relativePeriod draft (approved | contributed | provisional | unconfirmed) #IMPLIED >
<!--@METADATA-->

<!ELEMENT timeZoneNames ( alias | ( hourFormat*, hoursFormat*, gmtFormat*, gmtZeroFormat*, regionFormat*, fallbackFormat*, fallbackRegionFormat*, abbreviationFallback*, preferenceOrdering*, singleCountries*, default*, zone*, metazone*, special* ) ) >
<!ELEMENT timeZoneNames ( alias | ( hourFormat*, hoursFormat*, gmtFormat*, gmtZeroFormat*, gmtUnknownFormat*, regionFormat*, fallbackFormat*, fallbackRegionFormat*, abbreviationFallback*, preferenceOrdering*, singleCountries*, default*, zone*, metazone*, special* ) ) >
<!ATTLIST timeZoneNames draft (approved | contributed | provisional | unconfirmed | true | false) #IMPLIED >
<!--@METADATA-->
<!--@DEPRECATED-->
Expand Down Expand Up @@ -1765,6 +1765,15 @@ CLDR data files are interpreted according to the LDML specification (http://unic
<!ATTLIST gmtZeroFormat references CDATA #IMPLIED >
<!--@METADATA-->

<!ELEMENT gmtUnknownFormat ( #PCDATA ) >
<!ATTLIST gmtUnknownFormat alt NMTOKENS #IMPLIED >
<!--@MATCH:literal/variant-->
<!ATTLIST gmtUnknownFormat draft (approved | contributed | provisional | unconfirmed | true | false) #IMPLIED >
<!--@METADATA-->
<!--@DEPRECATED:true, false-->
<!ATTLIST gmtUnknownFormat references CDATA #IMPLIED >
<!--@METADATA-->

<!ELEMENT regionFormat ( #PCDATA ) >
<!ATTLIST regionFormat type (standard | daylight) #IMPLIED >
<!ATTLIST regionFormat alt NMTOKENS #IMPLIED >
Expand Down
1 change: 1 addition & 0 deletions common/dtd/ldml.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -4512,6 +4512,7 @@ Note: DTD @-annotations are not currently converted to .xsd. For full CLDR file
<xs:element maxOccurs="unbounded" minOccurs="0" ref="hoursFormat"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="gmtFormat"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="gmtZeroFormat"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="gmtUnknownFormat"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="regionFormat"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="fallbackFormat"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="fallbackRegionFormat"/>
Expand Down
1 change: 1 addition & 0 deletions common/main/root.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3189,6 +3189,7 @@ Warnings: All cp values have U+FE0F characters removed. See /annotationsDerived/
<hourFormat>+HH:mm;-HH:mm</hourFormat>
<gmtFormat>GMT{0}</gmtFormat>
<gmtZeroFormat>GMT</gmtZeroFormat>
<gmtUnknownFormat>GMT+?</gmtUnknownFormat>
<regionFormat>{0}</regionFormat>
<regionFormat type="daylight">{0} (+1)</regionFormat>
<regionFormat type="standard">{0} (+0)</regionFormat>
Expand Down
1 change: 1 addition & 0 deletions common/supplemental-temp/coverageLevels2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ For terms of use, see http://www.unicode.org/copyright.html
<coverageLevel value="basic" match="dates/timeZoneNames/fallbackFormat"/>
<coverageLevel value="basic" match="dates/timeZoneNames/gmtFormat"/>
<coverageLevel value="basic" match="dates/timeZoneNames/gmtZeroFormat"/>
<coverageLevel value="basic" match="dates/timeZoneNames/gmtUnknownFormat"/>
<coverageLevel value="basic" match="dates/timeZoneNames/hourFormat"/>
<coverageLevel value="basic" match="dates/timeZoneNames/metazone[@type='GMT']/long/standard"/>

Expand Down
1 change: 1 addition & 0 deletions common/supplemental/coverageLevels.xml
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ For terms of use, see http://www.unicode.org/copyright.html
<coverageLevel value="basic" match="dates/timeZoneNames/fallbackFormat"/>
<coverageLevel value="basic" match="dates/timeZoneNames/gmtFormat"/>
<coverageLevel value="basic" match="dates/timeZoneNames/gmtZeroFormat"/>
<coverageLevel value="basic" match="dates/timeZoneNames/gmtUnknownFormat"/>
<coverageLevel value="basic" match="dates/timeZoneNames/hourFormat"/>
<coverageLevel value="basic" match="dates/timeZoneNames/metazone[@type='GMT']/long/standard"/>

Expand Down
14 changes: 11 additions & 3 deletions docs/ldml/tr35-dates.md
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,7 @@ For examples, see [Day Periods Chart](https://www.unicode.org/cldr/charts/46/sup
## <a name="Time_Zone_Names" href="#Time_Zone_Names">Time Zone Names</a>

```xml
<!ELEMENT timeZoneNames (alias | (hourFormat*, gmtFormat*, gmtZeroFormat*, regionFormat*, fallbackFormat*, zone*, metazone*, special*)) >
<!ELEMENT timeZoneNames (alias | (hourFormat*, gmtFormat*, gmtZeroFormat*, gmtUnknownFormat*, regionFormat*, fallbackFormat*, zone*, metazone*, special*)) >

<!ELEMENT hourFormat ( #PCDATA ) >
<!ELEMENT gmtFormat ( #PCDATA ) >
Expand Down Expand Up @@ -1470,7 +1470,8 @@ The following subelements of `<timeZoneNames>` are used to control the fallback
<tr><td>"-1200"</td></tr>
<tr><td rowspan="2">gmtFormat</td><td>"GMT{0}"</td><td>"GMT-0800"</td></tr>
<tr><td>"{0}ВпГ"</td><td>"-0800ВпГ"</td></tr>
<tr><td>gmtZeroFormat</td><td>"GMT"</td><td>Specifies how GMT/UTC with no explicit offset (implied 0 offset) should be represented.</td></tr>
<tr><td>gmtZeroFormat</td><td>"GMT"</td><td>Specifies how GMT/UTC with an offset of zero should be represented.</td></tr>
<tr><td>gmtUnknownFormat</td><td>"GMT"</td><td>Specifies how GMT/UTC with an unknown offset should be represented.</td></tr>
<tr><td rowspan="2">regionFormat</td><td>"{0} Time"</td><td>"Japan Time"</td></tr>
<tr><td>"Hora de {0}"</td><td>"Hora de Japón"</td></tr>
<tr><td rowspan="2">regionFormat type="daylight"<br>(or "standard")</td><td>"{0} Daylight Time"</td><td>"France Daylight Time"</td></tr><tr><td>"horario de verano de {0}"</td><td>"horario de verano de Francia"</td></tr>
Expand Down Expand Up @@ -1704,12 +1705,18 @@ Note: A generic location format is constructed by a part of time zone ID represe
* "UTC-3" (short)
* "Гринуич+03:30" (long)

Otherwise (when the offset from GMT is zero, referring to GMT itself) the style specified by the `<gmtZeroFormat>` element is used:
Otherwise, when the offset from GMT is zero, the style specified by the `<gmtZeroFormat>` element is used:

* "GMT"
* "UTC"
* "Гринуич"

Otherwise, when the offset from GMT is not known, the style specified by the `<gmtUnknownFormat>` element is used:

* "GMT+?"
* "UTC+?"
* "Гринуич+?"

**ISO 8601 time zone formats:** The formats based on the [[ISO 8601](tr35.md#ISO8601)] local time difference from UTC ("+" sign is used when local time offset is 0), or the UTC indicator ("Z" - only when the local time offset is 0 and the specifier X\* is used). The ISO 8601 basic format does not use a separator character between hours and minutes field, while the extended format uses colon (':') as the separator. The ISO 8601 basic format with hours and minutes fields is equivalent to RFC 822 zone format.

* "-0800" (basic)
Expand Down Expand Up @@ -1842,6 +1849,7 @@ Some of the examples are drawn from real data, while others are for illustration
* America/Los_Angeles → "HMG-07:00" // daylight time
* Etc/GMT+3 → "GMT-03.00" // note that _TZ_ TZIDs have inverse polarity!
* Etc/Unknown → "GMT+07:00" // if the offset is known
* Etc/Unknown → "GMT+?" // if the offset is not known

**Note:** The digits should be whatever are appropriate for the locale used to format the time zone, not necessarily from the western digits, 0..9. For example, they might be from ०..९.

Expand Down
1 change: 1 addition & 0 deletions docs/site/translation/time-zones-and-city-names.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The following special patterns are used in formatting timezones.
|---|---|---|---|---|
| gmtFormat | GMT{0}<br /> *or*<br /> GMT{ HOURS_FROM_GMT } | GMT -2:00 | **GMT Pattern.** Modify this field if the format for GMT time uses different letters, such as HUA+0200 for GMT+02:00 , or if the letters GMT occur after the time. Make sure you include the {0} ; that is where the actual time value will go! | |
| gmtZeroFormat | GMT | GMT | **GMT Zero Pattern.** *This field must be consistent with the GMT Pattern.* | |
| gmtUnknownFormat | GMT+? | GMT+? | **GMT Unknown Pattern.** *This field must be consistent with the GMT Pattern.* | |
| hourFormat | +HH:mm;-HH:mm | GMT -02:00 | **GMT Hours Pattern.** This field controls the format for the time used with the GMT Pattern. It contains two patterns separated by a ";". The first controls positive time values (and zero), and the second controls the negative values. So to get *GMT+02.00* for positive values, and *GMT-02.00* for negative values, you'd use *+HH.mm;-HH.mm*. | |
| regionFormat | {0} Time<br /> *or*<br /> { COUNTRY } Time / { CITY } Time | Bolivia Time | **Location-Based Time Zone Pattern.** For generic references to time zones, the country is used if possible, composed with a pattern that in English appears as "{0} **Time** ". Thus a time zone may appear as "Malaysia **Time** " or " **Hora de** Malasia". If the country has multiple time zones, then a city is used to distinguish which one, thus "Argentina (La Rioja) **Time** ".<br /><br /> Some languages would normally have grammatical adjustments depending on what the name of the city is. For example, one might need "12:43 pm **Tempo d'** Australia" but "12:43 pm **Tempo de** Paris". In that case, there are two approaches:<br /><br /> 1. Use "{0}", which will give results like "12:43 pm Australia" and "12:43 pm Paris", or<br /> 2. Use a "form-style" phrasing such as " **Tempo de:** {0}", which will give results like "12:43 pm **Tempo de:** Australia" and "12:43 pm **Tempo de:** Paris". | |
| regionFormat-standard | {0} Standard Time<br /> *or*<br /> { COUNTRY } Standard Time / { CITY } Standard Time | Bolivia Standard Time | | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public class LDMLConstants {
public static final String HOURS_FORMAT = "hoursFormat";
public static final String GMT_FORMAT = "gmtFormat";
public static final String GMT_ZERO_FORMAT = "gmtZeroFormat";
public static final String GMT_UNKNOWN_FORMAT = "gmtUnknownFormat";
public static final String REGION_FORMAT = "regionFormat";
public static final String FALLBACK_FORMAT = "fallbackFormat";
public static final String ABBREVIATION_FALLBACK = "abbreviationFallback";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public CheckForCopy(Factory factory) {
+ "|intervalFormatItem"
+ "|exemplarCharacters\\[@type=\"(currencySymbol|index)\"]"
+ "|scientificFormat"
+ "|timeZoneNames/(hourFormat|gmtFormat|gmtZeroFormat)"
+ "|timeZoneNames/(hourFormat|gmtFormat|gmtZeroFormat|gmtUnknownFormat)"
+ "|dayPeriod"
+ "|(monthWidth|dayWidth|quarterWidth)\\[@type=\"(narrow|abbreviated)\"]"
+ "|exemplarCity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,14 @@ public CheckCLDR handleCheck(
result);
}
}
} else if (path.contains("/gmtFormat") || path.contains("/gmtZeroFormat")) {
} else if (path.contains("/gmtFormat")
|| path.contains("/gmtZeroFormat")
|| path.contains("/gmtUnknownFormat")) {
if (null
!= (disallowed =
containsAllCountingParens(exemplars, exemplarsPlusAscii, value))) {
disallowed.removeAll(LETTER); // Allow ASCII A-Z in gmtFormat and gmtZeroFormat
disallowed.removeAll(
LETTER); // Allow ASCII A-Z in gmtFormat, gmtZeroFormat, gmtUnknownFormat
if (disallowed.size() > 0) {
addMissingMessage(
disallowed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ boolean hasProblem(
Special.PLACEHOLDERS)
})
.add(
"//ldml/dates/timeZoneNames/(gmtFormat|gmtZeroFormat)",
"//ldml/dates/timeZoneNames/(gmtFormat|gmtZeroFormat|gmtUnknownFormat)",
new Limit[] { // GMT{0}, GMT
new Limit(
5 * EM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,7 @@ public String transform(String source) {
.put("gmtFormat", "GMT Format")
.put("hourFormat", "GMT Hours/Minutes Format")
.put("gmtZeroFormat", "GMT Zero Format")
.put("gmtUnknownFormat", "GMT Unknown Format")
.put("fallbackFormat", "Location Fallback Format")
.freeze();
final List<String> fieldOrder =
Expand All @@ -1623,6 +1624,7 @@ public String transform(String source) {
"gmtFormat",
"hourFormat",
"gmtZeroFormat",
"gmtUnknownFormat",
"fallbackFormat");

if (fieldOrder.contains(source)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<limit>MAXIMUM</limit>
<measure>DISPLAY_WIDTH</measure>
<special>PLACEHOLDERS</special>
<pathName>//ldml/dates/timeZoneNames/(gmtFormat|gmtZeroFormat)</pathName>
<pathName>//ldml/dates/timeZoneNames/(gmtFormat|gmtZeroFormat|gmtUnknownFormat)</pathName>
</path>
<!-- // Narrow items .add("//ldml/dates/calendars/calendar.*[@type=\"narrow\"](?!/cyclic|/dayPeriod|/monthPattern)",
new Limit[] { new Limit(1.5 * EM, 2.25 * EM, Measure.DISPLAY_WIDTH, LimitType.MAXIMUM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,9 @@ public void Test4897() {
String value = cldrFile.getStringValue(xpath);
String actual = exampleGenerator.getExampleHtml(xpath, value);
if (actual == null) {
if (!xpath.contains("singleCountries") && !xpath.contains("gmtZeroFormat")) {
if (!xpath.contains("singleCountries")
&& !xpath.contains("gmtZeroFormat")
&& !xpath.contains("gmtUnknownFormat")) {
errln("Null value for " + value + "\t" + xpath);
// for debugging
exampleGenerator.getExampleHtml(xpath, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
^//ldml/characters/stopwords/stopwordList\[@type=".*"] ; 60
^//ldml/dates/timeZoneNames/fallbackFormat ; 30
^//ldml/dates/timeZoneNames/gmtZeroFormat ; 30
^//ldml/dates/timeZoneNames/gmtUnknownFormat ; 30
^//ldml/dates/timeZoneNames/zone\[@type=".*"]/long/daylight ; 30
^//ldml/dates/timeZoneNames/zone\[@type=".*"]/short/daylight ; 30
^//ldml/fallback ; 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1720,7 +1720,7 @@ CLDR data files are interpreted according to the LDML specification (http://unic
<!ATTLIST relativePeriod draft (approved | contributed | provisional | unconfirmed) #IMPLIED >
<!--@METADATA-->

<!ELEMENT timeZoneNames ( alias | ( hourFormat*, hoursFormat*, gmtFormat*, gmtZeroFormat*, regionFormat*, fallbackFormat*, fallbackRegionFormat*, abbreviationFallback*, preferenceOrdering*, singleCountries*, default*, zone*, metazone*, special* ) ) >
<!ELEMENT timeZoneNames ( alias | ( hourFormat*, hoursFormat*, gmtFormat*, gmtZeroFormat*, gmtUnknownFormat*, regionFormat*, fallbackFormat*, fallbackRegionFormat*, abbreviationFallback*, preferenceOrdering*, singleCountries*, default*, zone*, metazone*, special* ) ) >
<!ATTLIST timeZoneNames draft (approved | contributed | provisional | unconfirmed | true | false) #IMPLIED >
<!--@METADATA-->
<!--@DEPRECATED-->
Expand Down

0 comments on commit 6068376

Please sign in to comment.