• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# File that produces shorter names
2# Variables for attribute values and elements
3$avalue=[^"]*;
4$element=[a-zA-Z0-9]+;
5
6# Complete noise
7'//ldml' > ;
8
9# First codes list
10'/localeDisplayNames/languages/' ($element) '[@type="' ($avalue) '"]' > '0-names|' $1 '|' $2;
11'/localeDisplayNames/scripts/' ($element) '[@type="' ($avalue) '"]' > '0-names|' $1 '|' $2;
12'/localeDisplayNames/territories/' ($element) '[@type="' ($avalue) '"]' > '0-names|' $1 '|' $2;
13'/localeDisplayNames/variants/' ($element) '[@type="' ($avalue) '"]' > '0-names|' $1 '|' $2;
14'/localeDisplayNames/keys/' ($element) '[@type="' ($avalue) '"]' > '0-names|type|' $2;
15'/localeDisplayNames/types/' ($element) '[@type="' ($avalue) '"]'  '[@key="' ($avalue) '"]' > '0-names|' $1 '|' $3 '-' $2;
16'/localeDisplayNames/codePatterns/' ($element) '[@type="' ($avalue) '"]' > '0-names|' $1 '|' $2;
17'/localeDisplayNames/localeDisplayPattern/' ($element) > '0-names|localeDisplayPattern|' $1;
18'/localeDisplayNames/transformNames/transformName[@type="' ($avalue) '"]' > '0-names|transforms|' $1;
19
20'/localeDisplayNames/languages/alias' > '0-names|language|alias';
21'/localeDisplayNames/territories/alias' > '0-names|territory|alias';
22
23'/layout/orientation' > '1-misc|layout|orientation';
24
25'/contextTransforms/contextTransformUsage[@type="' ($avalue) '"]/contextTransform[@type="' ($avalue) '"]' > '1-misc|contextTransforms|' $1 '/' $2;
26'/contextTransforms/contextTransformUsage[@type="' ($avalue) '"]/alias' > '1-misc|contextTransforms|$1-alias';
27
28'/characters/exemplarCharacters[@type="index"]' > '1-misc|indexCharacters|';
29'/characters/exemplarCharacters[@type="' ($avalue) '"]' > '1-misc|exemplarCharacters|2-' $1;
30'/characters/exemplarCharacters' > '1-misc|exemplarCharacters|2-main';
31
32'/characters/stopwords/stopwordList[@type="' ($avalue) '"]' > '1-misc|stopwords|' $1;
33
34'/characters/indexLabels/indexLabel[@indexSource="' ($avalue) '"]' > '1-misc|indexLabels|label-' $1;
35'/characters/indexLabels/' ($element) > '1-misc|indexLabels|' $1;
36
37'/characters/ellipsis[@type="' ($avalue) '"]' > '1-misc|ellipsisPatterns|' $1;
38'/characters/moreInformation' > '1-misc|information|symbol';
39
40'/listPatterns/listPattern/listPatternPart[@type="' ($avalue) '"]' > '1-misc|listPattern|' $1;
41
42'/delimiters/'(.*) > '1-misc|delimiters|' $1;
43'/fallback' > '1-misc|fallback|locales' ;
44
45# catch defaults:
46# //ldml/dates/calendars/calendar[@type="buddhist"]/X/default
47
48'/dates/calendars/default' > '3-deprecated|default|calendar';
49'/dates/calendars/calendar[@type="' ($avalue) '"]/' ($element) '/default' > '3-deprecated|default|calendar-' $1 '-' $2;
50'/dates/localizedPatternChars' > '3-deprecated|dates|localizedPatternChars';
51# '$%%/dateTimeFormats/default' > '3-deprecated|default|date+time|default';
52
53# The $%% is used to break up the transformation into two chunks, for modularization
54
55#'/dates/calendars/calendar[@type="' 'gregorian' '"]' > 'calendar-' | '$%%';
56'/dates/calendars/calendar[@type="' ($avalue) '"]' > 'calendar-' $1 | '$%%';
57
58'/identity/' ($element) '[@type="' ($avalue) '"]' > 'identity|' $1 '|' $2;
59'/identity/' ($element) > 'identity|info|' $1;
60# /identity/generation
61# identity|info|territory?%%[@type="DJ"]
62
63'/localeDisplayNames/measurementSystemNames/measurementSystemName[@type="' ($avalue) '"]' > '0-names|measurement-system|' $1;
64'/references/reference[@type="' ($avalue) '"]' > 'references|reference|' $1;
65
66'$%%/eras/era' ($element) '/era[@type="' ([0-9]) '"]' > '|era|[00' $2 ']-' $1;
67'$%%/eras/era' ($element) '/era[@type="' ([0-9][0-9]) '"]' > '|era|[0' $2 ']-' $1;
68'$%%/eras/era' ($element) '/era[@type="' ($avalue) '"]' > '|era|[' $2 ']-' $1;
69
70'$%%/dateFormats/dateFormatLength[@type="' ($avalue) '"]/dateFormat[@type="standard"]/pattern[@type="standard"]' > '|pattern|date-' $1;
71'$%%/timeFormats/timeFormatLength[@type="' ($avalue) '"]/timeFormat[@type="standard"]/pattern[@type="standard"]' > '|pattern|time-' $1;
72'$%%/dateTimeFormats/dateTimeFormatLength[@type="' ($avalue) '"]/dateTimeFormat[@type="standard"]/pattern[@type="standard"]' > '|pattern|datetime-' $1;
73
74'$%%/months/monthContext[@type="' ($avalue) '"]/monthWidth[@type="' ($avalue) '"]/month[@type="' ([0-9]) '"][@yeartype="leap"]' > '|month|[0' $3 ']-' $1 '-' $2 '-leap';
75'$%%/months/monthContext[@type="' ($avalue) '"]/monthWidth[@type="' ($avalue) '"]/month[@type="' ($avalue) '"][@yeartype="leap"]' > '|month|[' $3 ']-' $1 '-' $2 '-leap';
76
77'$%%/months/monthContext[@type="' ($avalue) '"]/monthWidth[@type="' ($avalue) '"]/month[@type="' ([0-9]) '"]' > '|month|[0' $3 ']-' $1 '-' $2;
78'$%%/months/monthContext[@type="' ($avalue) '"]/monthWidth[@type="' ($avalue) '"]/month[@type="' ($avalue) '"]' > '|month|[' $3 ']-' $1 '-' $2;
79'$%%/months/monthContext[@type="' ($avalue) '"]/monthWidth[@type="' ($avalue) '"]/alias' > '|month|' $1 '-' $2 '-alias';
80
81'$%%/monthPatterns/monthPatternContext[@type="' ($avalue) '"]/monthPatternWidth[@type="' ($avalue) '"]/monthPattern[@type="' ($avalue) '"]' > '|monthPattern|[' $3 ']-' $1 '-' $2;
82'$%%/monthPatterns/monthPatternContext[@type="' ($avalue) '"]/monthPatternWidth[@type="' ($avalue) '"]/alias' > '|monthPattern|' $1 '-' $2 '-alias';
83
84'$%%/months/monthContext[@type="' ($element) '"]/default' > '|month|default-' $1;
85'$%%/days/dayContext[@type="' ($element) '"]/default' > '|day|default-' $1;
86
87'$%%/eras/alias' > '|eras|alias';
88'$%%/eras/eraNames/alias' > '|eraNames|alias';
89'$%%/months/alias' > '|months|alias';
90'$%%/alias' > '|all|alias';
91
92'$%%/week/' ($element) > '|week|' $1;
93
94'$%%/days/dayContext[@type="' ($avalue) '"]/dayWidth[@type="' ($avalue) '"]/day[@type="' ('sun') '"]' > '|day|1-sunday:' $1 '-' $2;
95'$%%/days/dayContext[@type="' ($avalue) '"]/dayWidth[@type="' ($avalue) '"]/day[@type="' ('mon') '"]' > '|day|2-monday:' $1 '-' $2;
96'$%%/days/dayContext[@type="' ($avalue) '"]/dayWidth[@type="' ($avalue) '"]/day[@type="' ('tue') '"]' > '|day|3-tuesday:' $1 '-' $2;
97'$%%/days/dayContext[@type="' ($avalue) '"]/dayWidth[@type="' ($avalue) '"]/day[@type="' ('wed') '"]' > '|day|4-wednesday:' $1 '-' $2;
98'$%%/days/dayContext[@type="' ($avalue) '"]/dayWidth[@type="' ($avalue) '"]/day[@type="' ('thu') '"]' > '|day|5-thursday:' $1 '-' $2;
99'$%%/days/dayContext[@type="' ($avalue) '"]/dayWidth[@type="' ($avalue) '"]/day[@type="' ('fri') '"]' > '|day|6-friday:' $1 '-' $2;
100'$%%/days/dayContext[@type="' ($avalue) '"]/dayWidth[@type="' ($avalue) '"]/day[@type="' ('sat') '"]' > '|day|7-saturday:' $1 '-' $2;
101
102'$%%/quarters/quarterContext[@type="' ($avalue) '"]/quarterWidth[@type="' ($avalue) '"]/quarter[@type="' ($avalue) '"]' > '|quarter|[' $3 ']-' $1 '-' $2;
103
104'$%%/' ([ap]) 'm' > '|day-period|' $1 'm';
105
106# //ldml/dates/calendars/calendar[@type="gregorian"]/dayPeriods/dayPeriodContext[@type="format"]/dayPeriodWidth[@type="wide"]/dayPeriod[@type="am"]
107
108'$%%/dayPeriods/dayPeriodContext[@type="' ($avalue) '"]/dayPeriodWidth[@type="' ($avalue) '"]/dayPeriod[@type="' ($avalue) '"]' > '|dayPeriod|[' $3 ']-' $1 '-' $2;
109'$%%/dayPeriods/dayPeriodContext[@type="' ($avalue) '"]/dayPeriodWidth[@type="' ($avalue) '"]/alias' > '|dayPeriod|' $1 '-' $2 '-alias';
110'$%%/dayPeriods/dayPeriodContext[@type="' ($avalue) '"]/alias' > '|dayPeriod|' $1 '-alias';
111'$%%/dayPeriods/alias' > '|dayPeriod|-alias';
112
113'$%%/cyclicNameSets/cyclicNameSet[@type="' ($avalue) '"]/cyclicNameContext[@type="' ($avalue) '"]/cyclicNameWidth[@type="' ($avalue) '"]/cyclicName[@type="' ([0-9]) '"]' > '|cyclicName|[0' $4 ']-' $1 '-' $2 '-' $3;
114'$%%/cyclicNameSets/cyclicNameSet[@type="' ($avalue) '"]/cyclicNameContext[@type="' ($avalue) '"]/cyclicNameWidth[@type="' ($avalue) '"]/cyclicName[@type="' ($avalue) '"]' > '|cyclicName|[' $4 ']-' $1 '-' $2 '-' $3;
115'$%%/cyclicNameSets/cyclicNameSet[@type="' ($avalue) '"]/cyclicNameContext[@type="' ($avalue) '"]/cyclicNameWidth[@type="' ($avalue) '"]/alias' > '|cyclicName|' $1 '-' $2 '-' $3 '-alias';
116
117'$%%/fields/field[@type="' ($avalue) '"]/displayName' > '|field-label|' $1;
118
119'$%%/dateTimeFormats/availableFormats/dateFormatItem[@id="' ($avalue) '"]' > '|pattern|' $1;
120'$%%/dateTimeFormats/appendItems/appendItem[@request="' ($avalue) '"]' > '|pattern|append-' $1;
121
122'$%%/dateTimeFormats/intervalFormats/intervalFormatItem[@id="' ($avalue) '"]/greatestDifference[@id="' ($avalue) '"]'     > '|pattern|interval-' $1 '-' $2;
123'$%%/dateTimeFormats/intervalFormats/intervalFormatFallback'     > '|pattern|interval-fallback';
124
125'$%%/dateFormats/default' > '|default|dateFormat';
126'$%%/timeFormats/default' > '|default|timeFormat';
127'$%%/months/default' > '|default|monthFormat';
128'$%%/days/default' > '|default|dayFormat';
129'$%%/dateTimeFormats/dateTimeFormatLength/dateTimeFormat[@type="standard"]/pattern[@type="standard"]' > '|pattern|date+time';
130'$%%/dateTimeFormats/alias' > '|date+time|alias';
131'$%%/dateFormats/alias' > '|date|alias';
132'$%%/timeFormats/alias' > '|time|alias';
133
134'$%%/fields/field[@type="' ($avalue) '"]/relative[@type="' ($avalue) '"]' > '|fields|' $1 ':' $2 ;
135
136'/dates/fields/field[@type="' ($avalue) '"]/displayName' > '|field-label|' $1;
137'/dates/fields/field[@type="' ($avalue) '"]/relative[@type="' ($avalue) '"]' > '|fields|' $1 ':' $2 ;
138
139'/dates/timeZoneNames/zone[@type="' ($avalue) '"]/exemplarCity' > '0-names|time-zone-cities|' &prettyPathZone($1);
140'/dates/timeZoneNames/zone[@type="' ($avalue) '"]/usesMetazone' (.*) > '3-time-zone|uses-metazone|' &prettyPathZone($1) '-uses-' $2;
141'/dates/timeZoneNames/zone[@type="' ($avalue) '"]/' ($element) '/' ($element) > '0-names|time-zone-old|' &prettyPathZone($1) ':' $3 '-' $2;
142'/dates/timeZoneNames/zone[@type="' ($avalue) '"]/' ($element) > '0-names|time-zone-old|' &prettyPathZone($1) ':' $2;
143'/dates/timeZoneNames/metazone[@type="' ($avalue) '"]/' ($element) '/' ($element) > '0-names|metazone|' $1 ':' $3 '-' $2;
144'/dates/timeZoneNames/metazone[@type="' ($avalue) '"]/' ($element) > '0-names|metazone|' $1 ':' $2;
145'/dates/timeZoneNames/abbreviationFallback' (.*) > '3-deprecated|time-zones|abbreviationFallback' $1;
146'/dates/timeZoneNames/hoursFormat' (.*) > '3-deprecated|time-zones|hoursFormat' $1;
147'/dates/timeZoneNames/preferenceOrdering' (.*) > '3-deprecated|time-zones|preferenceOrdering' $1;
148
149'/dates/timeZoneNames/' (.*) > '3-time-zone|pattern|' $1;
150
151'/dates/dateRangePattern' > '3-time-zone|pattern|date-range';
152
153'/numbers/currencies/currency[@type="' ($avalue) '"]/displayName[@type="' ($avalue) '"]' > '0-names|currency|' $1 ':name-' $2;
154'/numbers/currencies/currency[@type="' ($avalue) '"]/displayName' > '0-names|currency|' $1 ':name';
155'/numbers/currencies/currency[@type="' ($avalue) '"]/' ($element) '[@type="' ($avalue) '"]' > '0-names|currency|' $1 ':' $2 '-' $3;
156'/numbers/currencies/currency[@type="' ($avalue) '"]/' ($element) > '0-names|currency|' $1 ':' $2;
157
158'/numbers/symbols/' (.*) > '2-number|symbol|' $1;
159'/numbers/symbols[@numberSystem="latn"]/' (.*) > '2-number|symbol|' $1;
160'/numbers/symbols[@numberSystem="' ($avalue) '"]/' (.*) > '2-number|symbol|' $2 '-' $1;
161
162'/numbers/' ([a-z]+) 'Formats/' ($element) '/' ($element) '[@type="' ($avalue) '"]/pattern[@type="standard"]' > '2-number|pattern|' $1;
163'/numbers/' ([a-z]+) 'Formats[@numberSystem="latn"]/' ($element) '/' ($element) '[@type="' ($avalue) '"]/pattern[@type="standard"]' > '2-number|pattern|' $1;
164'/numbers/' ([a-z]+) 'Formats[@numberSystem="' ($avalue) '"]/' ($element) '/' ($element) '[@type="' ($avalue) '"]/pattern[@type="standard"]' > '2-number|pattern|' $1 '-' $2;
165'/numbers/decimalFormats/decimalFormatLength[@type="' ($avalue) '"]/decimalFormat[@type="standard"]/pattern[@type="' ($avalue) '"]' > '2-number|pattern|decimal-' $1 '-' $2;
166
167'/numbers/' ([a-z]+) 'Formats[@numberSystem="latn"]/' ($element) '[@type="' ($avalue) '"]/' ($element) '[@type="standard"]/pattern[@type="' ($avalue) '"]' > '2-number|pattern|' $1 '-' $5;
168'/numbers/' ([a-z]+) 'Formats[@numberSystem="' ($avalue) '"]/' ($element) '[@type="' ($avalue) '"]/' ($element) '[@type="standard"]/pattern[@type="' ($avalue) '"]' > '2-number|pattern|' $1 '-' $6 '-' $2;
169
170# //ldml/numbers/decimalFormats/decimalFormatLength[@type="short"]/decimalFormat[@type="standard"]/pattern[@type="1000"]
171
172'/numbers/currencyFormats[@numberSystem="latn"]/currencySpacing/beforeCurrency/' (.*) > '2-number|currency|match-before-' $1;
173'/numbers/currencyFormats[@numberSystem="latn"]/currencySpacing/afterCurrency/' (.*) > '2-number|currency|match-after-' $1;
174'/numbers/currencyFormats[@numberSystem="latn"]/unitPattern' > '2-number|currency|name-pattern';
175'/numbers/currencyFormats[@numberSystem="' ($avalue) '"]/unitPattern' > '2-number|currency|name-pattern-' $1;
176'/numbers/defaultNumberingSystem' > '2-number|numberingSystems|default';
177'/numbers/otherNumberingSystems/native' > '2-number|numberingSystems|native';
178'/numbers/otherNumberingSystems/finance' > '2-number|numberingSystems|financial';
179'/numbers/otherNumberingSystems/traditional' > '2-number|numberingSystems|traditional';
180'/posix/messages/' (.*) > '1-misc|posix|' $1;
181
182'/units/unitLength[@type="' ($avalue) '"]/unit[@type="' ($avalue) '"]/unitPattern' > '0-units' $1 '|pattern|' $2 ;
183
184#'[@alt="proposed' ($avalue) '"]' > '/' \u200B 'alt'; # remove!
185'[@alt="' ($avalue) '"]' > '/' \u200B 'alt-' $1;
186
187'[@count="' ($avalue) '"]' > '/' \u200B $1;
188
189'/alias' > 'whole|file|alias';
190'/characters/mapping[@registry="' ($element) '"]' > '3-deprecated|charset-registry|' $1;
191'/layout/inList' > '1-misc|casing|in_lists';
192'/layout/inText[@type="' ($avalue) '"]' > '1-misc|casing|' $1;
193
194'/numbers/scientificFormats/default' > '3-deprecated|default|scientificFormats';
195
196# This is used to mark any transformation that fails at some point
197(.*) > '?%%' $1;
198
199
200