Skip to content

Commit ae80d4f

Browse files
jeffreyameyerclaude
andcommitted
Expand README ant section, seed five locale bundles
README.md - 'Ant + Ivy (JOSM plugins)' becomes generic 'Ant + Ivy' with a paragraph explaining the default Ivy resolver chain and a pointer at smoke/ as a complete worked example any downstream Ant consumer can crib from. Removes the JOSM-specific framing so the section reads as the canonical reference for any Ant user. - All dependency snippets bumped from 0.2.0 to 0.3.0 (Maven, Gradle, Ivy). - Status banner updated: latest release 0.3.0, available on Maven Central since 0.2.0. src/main/resources/io/github/openhistoricalmap/edtf/format/ Five new locale bundles seeded as bootstrap translations: messages_de, messages_es, messages_fr, messages_it, messages_ja. Same key set as the canonical English messages.properties. Non-ASCII characters use \u escapes so the files survive transcoding regardless of editor. These are bootstrap translations to seed the Transifex project; per CONTRIBUTING.md, ongoing translation work flows through tx pull / push rather than direct file edits. EdtfFormatterTest Nine new tests exercising locale switching: German qualifier, interval, and locale-aware month name (java.time picks up 'Mai' for May automatically); French qualifier and interval; Spanish century / decade; Italian BCE year; Japanese season. Plus a fallback test (a Klingon-locale formatter still produces English because no messages_tlh.properties exists). Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1e85c8c commit ae80d4f

7 files changed

Lines changed: 272 additions & 6 deletions

File tree

README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Format (EDTF)][edtf] strings, per **ISO 8601-2:2019** (with Amendment 1,
1212
This is a port of the JavaScript library [edtf.js][edtf-js] to the JVM,
1313
targeting Java 17+ with zero runtime dependencies.
1414

15-
> **Status**: First public release (0.2.0). Available on Maven
16-
> Central.
15+
> **Status**: Latest release `0.3.0`. Available on Maven Central
16+
> (since `0.2.0`).
1717
1818
## Quick start
1919

@@ -37,22 +37,40 @@ Available on Maven Central as of `0.2.0`.
3737
<dependency>
3838
<groupId>io.github.openhistoricalmap</groupId>
3939
<artifactId>edtf</artifactId>
40-
<version>0.2.0</version>
40+
<version>0.3.0</version>
4141
</dependency>
4242
```
4343

4444
### Gradle
4545

4646
```groovy
47-
implementation 'io.github.openhistoricalmap:edtf:0.2.0'
47+
implementation 'io.github.openhistoricalmap:edtf:0.3.0'
4848
```
4949

50-
### Ant + Ivy (JOSM plugins)
50+
### Ant + Ivy
51+
52+
For Ant projects that resolve dependencies via [Apache Ivy][ivy].
53+
Drop this into the `<dependencies>` block of your `ivy.xml`:
5154

5255
```xml
53-
<dependency org="io.github.openhistoricalmap" name="edtf" rev="0.2.0"/>
56+
<dependency org="io.github.openhistoricalmap" name="edtf" rev="0.3.0"/>
5457
```
5558

59+
The default Ivy resolver chain pulls from Maven Central
60+
(`repo1.maven.org`), so no additional `ivysettings.xml` is needed
61+
in most cases. If you maintain a custom resolver chain, ensure
62+
Maven Central is reachable.
63+
64+
A complete worked example lives at [`smoke/`](smoke/) in this
65+
repository: a self-contained Ant project (`build.xml` + `ivy.xml` +
66+
`src/Smoke.java`) that resolves the published artefact, compiles
67+
against it, runs a tiny program, and asserts on the output.
68+
[`.github/workflows/smoke.yml`](.github/workflows/smoke.yml) runs
69+
it daily as a regression check &mdash; the same setup any
70+
downstream Ant consumer can crib from.
71+
72+
[ivy]: https://ant.apache.org/ivy/
73+
5674
## EDTF coverage
5775

5876
| Level | Description | Status |
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# German translation of edtf-java formatter strings.
2+
#
3+
# These initial translations seed Transifex; future updates should
4+
# come through the tx pull / push workflow rather than direct edits.
5+
# See CONTRIBUTING.md "Localization" for the contributor flow.
6+
#
7+
# Java 9+ reads .properties files as UTF-8 by default, but \\u
8+
# escapes are used here for non-ASCII characters so the files are
9+
# readable in any editor and survive transcoding.
10+
11+
qualifier.uncertain = {0} (unsicher)
12+
qualifier.approximate = circa {0}
13+
qualifier.mixed = circa {0} (unsicher)
14+
15+
decade = die {0}er Jahre
16+
century = die {0}er Jahre
17+
18+
year.ce = {0}
19+
year.bce = {0} v. Chr.
20+
year.large = Jahr {0}
21+
22+
season.21 = Q1 {0}
23+
season.22 = Q2 {0}
24+
season.23 = Q3 {0}
25+
season.24 = Q4 {0}
26+
27+
interval.bounded = {0} bis {1}
28+
interval.openLower = vor {0}
29+
interval.openUpper = ab {0}
30+
interval.openBoth = jederzeit
31+
interval.unknownLower = bis {0}
32+
interval.unknownUpper = ab {0}
33+
34+
set.empty = (leere Menge)
35+
set.one = {0}
36+
set.two = {0} oder {1}
37+
set.many = eines von: {0}
38+
list.empty = (leere Liste)
39+
list.one = {0}
40+
list.two = {0} und {1}
41+
list.many = {0}
42+
43+
fallback = {0}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Spanish translation of edtf-java formatter strings.
2+
# See messages_de.properties for the Transifex bootstrap note.
3+
4+
qualifier.uncertain = {0} (incierto)
5+
qualifier.approximate = circa {0}
6+
qualifier.mixed = circa {0} (incierto)
7+
8+
decade = los a\u00f1os {0}
9+
century = los a\u00f1os {0}
10+
11+
year.ce = {0}
12+
year.bce = {0} a. C.
13+
year.large = A\u00f1o {0}
14+
15+
season.21 = T1 {0}
16+
season.22 = T2 {0}
17+
season.23 = T3 {0}
18+
season.24 = T4 {0}
19+
20+
interval.bounded = de {0} a {1}
21+
interval.openLower = antes de {0}
22+
interval.openUpper = desde {0}
23+
interval.openBoth = en cualquier momento
24+
interval.unknownLower = hasta {0}
25+
interval.unknownUpper = desde {0}
26+
27+
set.empty = (conjunto vac\u00edo)
28+
set.one = {0}
29+
set.two = {0} o {1}
30+
set.many = uno de: {0}
31+
list.empty = (lista vac\u00eda)
32+
list.one = {0}
33+
list.two = {0} y {1}
34+
list.many = {0}
35+
36+
fallback = {0}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# French translation of edtf-java formatter strings.
2+
# See messages_de.properties for the Transifex bootstrap note.
3+
4+
qualifier.uncertain = {0} (incertain)
5+
qualifier.approximate = vers {0}
6+
qualifier.mixed = vers {0} (incertain)
7+
8+
decade = les ann\u00e9es {0}
9+
century = les ann\u00e9es {0}
10+
11+
year.ce = {0}
12+
year.bce = {0} av. J.-C.
13+
year.large = An {0}
14+
15+
season.21 = T1 {0}
16+
season.22 = T2 {0}
17+
season.23 = T3 {0}
18+
season.24 = T4 {0}
19+
20+
interval.bounded = de {0} \u00e0 {1}
21+
interval.openLower = avant {0}
22+
interval.openUpper = \u00e0 partir de {0}
23+
interval.openBoth = \u00e0 tout moment
24+
interval.unknownLower = jusqu'\u00e0 {0}
25+
interval.unknownUpper = depuis {0}
26+
27+
set.empty = (ensemble vide)
28+
set.one = {0}
29+
set.two = {0} ou {1}
30+
set.many = l''un de\u00a0: {0}
31+
list.empty = (liste vide)
32+
list.one = {0}
33+
list.two = {0} et {1}
34+
list.many = {0}
35+
36+
fallback = {0}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Italian translation of edtf-java formatter strings.
2+
# See messages_de.properties for the Transifex bootstrap note.
3+
4+
qualifier.uncertain = {0} (incerto)
5+
qualifier.approximate = circa {0}
6+
qualifier.mixed = circa {0} (incerto)
7+
8+
decade = gli anni {0}
9+
century = gli anni {0}
10+
11+
year.ce = {0}
12+
year.bce = {0} a.C.
13+
year.large = Anno {0}
14+
15+
season.21 = T1 {0}
16+
season.22 = T2 {0}
17+
season.23 = T3 {0}
18+
season.24 = T4 {0}
19+
20+
interval.bounded = dal {0} al {1}
21+
interval.openLower = prima del {0}
22+
interval.openUpper = dal {0} in poi
23+
interval.openBoth = in qualsiasi momento
24+
interval.unknownLower = fino al {0}
25+
interval.unknownUpper = dal {0}
26+
27+
set.empty = (insieme vuoto)
28+
set.one = {0}
29+
set.two = {0} o {1}
30+
set.many = uno tra: {0}
31+
list.empty = (lista vuota)
32+
list.one = {0}
33+
list.two = {0} e {1}
34+
list.many = {0}
35+
36+
fallback = {0}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Japanese translation of edtf-java formatter strings.
2+
# See messages_de.properties for the Transifex bootstrap note.
3+
4+
qualifier.uncertain = {0}\uff08\u4e0d\u78ba\u5b9f\uff09
5+
qualifier.approximate = \u7d04{0}
6+
qualifier.mixed = \u7d04{0}\uff08\u4e0d\u78ba\u5b9f\uff09
7+
8+
decade = {0}\u5e74\u4ee3
9+
century = {0}\u5e74\u4ee3
10+
11+
year.ce = {0}\u5e74
12+
year.bce = \u7d00\u5143\u524d{0}\u5e74
13+
year.large = {0}\u5e74
14+
15+
season.21 = {0}\u5e74\u7b2c1\u56db\u534a\u671f
16+
season.22 = {0}\u5e74\u7b2c2\u56db\u534a\u671f
17+
season.23 = {0}\u5e74\u7b2c3\u56db\u534a\u671f
18+
season.24 = {0}\u5e74\u7b2c4\u56db\u534a\u671f
19+
20+
interval.bounded = {0}\u304b\u3089{1}
21+
interval.openLower = {0}\u4ee5\u524d
22+
interval.openUpper = {0}\u4ee5\u964d
23+
interval.openBoth = \u3044\u3064\u3067\u3082
24+
interval.unknownLower = {0}\u307e\u3067
25+
interval.unknownUpper = {0}\u304b\u3089
26+
27+
set.empty = \uff08\u7a7a\u96c6\u5408\uff09
28+
set.one = {0}
29+
set.two = {0}\u307e\u305f\u306f{1}
30+
set.many = \u6b21\u306e\u3044\u305a\u308c\u304b: {0}
31+
list.empty = \uff08\u7a7a\u30ea\u30b9\u30c8\uff09
32+
list.one = {0}
33+
list.two = {0}\u3068{1}
34+
list.many = {0}
35+
36+
fallback = {0}

src/test/java/io/github/openhistoricalmap/edtf/format/EdtfFormatterTest.java

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,65 @@ void maskedDateFallsBackToCanonical() {
121121
// X-masks aren't yet handled by the formatter; falls back.
122122
assertThat(f.format(Edtf.parse("2020-XX"))).isEqualTo("2020-XX");
123123
}
124+
125+
// ----- locale switching -----
126+
127+
@Test
128+
void germanQualifier() {
129+
EdtfFormatter de = EdtfFormatter.forLocale(Locale.GERMAN);
130+
assertThat(de.format(Edtf.parse("2020?"))).isEqualTo("2020 (unsicher)");
131+
assertThat(de.format(Edtf.parse("2020~"))).isEqualTo("circa 2020");
132+
}
133+
134+
@Test
135+
void germanInterval() {
136+
EdtfFormatter de = EdtfFormatter.forLocale(Locale.GERMAN);
137+
assertThat(de.format(Edtf.parse("2020/2021"))).isEqualTo("2020 bis 2021");
138+
assertThat(de.format(Edtf.parse("../2020"))).isEqualTo("vor 2020");
139+
}
140+
141+
@Test
142+
void germanMonthUsesLocaleMonthNames() {
143+
EdtfFormatter de = EdtfFormatter.forLocale(Locale.GERMAN);
144+
// java.time supplies the month name in German automatically.
145+
assertThat(de.format(Edtf.parse("2020-05"))).isEqualTo("Mai 2020");
146+
}
147+
148+
@Test
149+
void frenchQualifier() {
150+
EdtfFormatter fr = EdtfFormatter.forLocale(Locale.FRENCH);
151+
assertThat(fr.format(Edtf.parse("2020~"))).isEqualTo("vers 2020");
152+
}
153+
154+
@Test
155+
void frenchInterval() {
156+
EdtfFormatter fr = EdtfFormatter.forLocale(Locale.FRENCH);
157+
assertThat(fr.format(Edtf.parse("2020/2021"))).isEqualTo("de 2020 \u00e0 2021");
158+
}
159+
160+
@Test
161+
void spanishCenturyAndDecade() {
162+
EdtfFormatter es = EdtfFormatter.forLocale(new Locale("es"));
163+
assertThat(es.format(Edtf.parse("199"))).isEqualTo("los a\u00f1os 1990");
164+
assertThat(es.format(Edtf.parse("20"))).isEqualTo("los a\u00f1os 2000");
165+
}
166+
167+
@Test
168+
void italianBceYear() {
169+
EdtfFormatter it = EdtfFormatter.forLocale(Locale.ITALIAN);
170+
assertThat(it.format(Edtf.parse("-0044"))).isEqualTo("44 a.C.");
171+
}
172+
173+
@Test
174+
void japaneseSeason() {
175+
EdtfFormatter ja = EdtfFormatter.forLocale(Locale.JAPANESE);
176+
assertThat(ja.format(Edtf.parse("2020-21"))).isEqualTo("2020\u5e74\u7b2c1\u56db\u534a\u671f");
177+
}
178+
179+
@Test
180+
void unknownLocaleFallsBackToDefaultBundle() {
181+
// Klingon hasn't been added; should fall back to root (English).
182+
EdtfFormatter kl = EdtfFormatter.forLocale(new Locale("tlh"));
183+
assertThat(kl.format(Edtf.parse("2020?"))).isEqualTo("2020 (uncertain)");
184+
}
124185
}

0 commit comments

Comments
 (0)