@johnmorrisdotca/sugoroku 1.1.1 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,20 @@ All notable changes to this project are written here. The format follows
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.2.1] - 2026-12-06
10
+
11
+ ### Fixed
12
+
13
+ - French wording from the French review: "double" in the cube lines now reads "doublement", since a double in French backgammon means two equal dice.
14
+
15
+ ## [1.2.0] - 2026-12-06
16
+
17
+ ### Added
18
+
19
+ - French: the board's words (`SUGOROKU_STRINGS.fr`, in `src/strings-fr.data.ts`), chosen by `lang="fr"` (or any `fr-*` tag) on the board or the page, or `language: "fr"`; the position element's default label too. The builder and embed page offer French. Every French string is listed beside its English in `docs/strings-fr.md`, made and held by a test like `docs/strings-ja.md`.
20
+
21
+ - The README opens with the package's thumbnail, and the demo carries it as its link preview (og:image) and publishes the card, a dark card and an icon on Pages at `thumbnail.png`, `thumbnail-dark.png` and `icon.png`.
22
+
9
23
  ## [1.1.1] - 2026-10-31
10
24
 
11
25
  ### Changed
package/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ <p align="center"><a href="https://johnmorrisdotca.github.io/sugoroku/"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/johnmorrisdotca/sugoroku/main/docs/images/thumbnail-dark.png"><img src="https://raw.githubusercontent.com/johnmorrisdotca/sugoroku/main/docs/images/thumbnail.png" alt="Sugoroku: a backgammon board drawn as SVG in the middle of a match, the doubling cube at 2 and two dice just rolled." width="1200"></picture></a></p>
2
+
1
3
  <h1 align="center">Sugoroku <sub>双六</sub> — Backgammon and its variants</h1>
2
4
 
3
5
  <p align="center"><strong>Backgammon and its variants for JavaScript and TypeScript.</strong><br>
@@ -85,7 +87,7 @@ And in a page, a game to play against the computer, by touch and mouse, with not
85
87
  - **Drawn as SVG text**, in an entry of its own: five boards, four sets of checkers, and either way up for a phone.
86
88
  - **Played in any page** by touch and mouse (tap a checker then a point, or drag), as one function call (`mountSugoroku`) or one tag (`<sugoroku-board>`), with a match, a cube, undo and a record kept for you.
87
89
  - **Optional sounds**: short CC0 clips for a checker set down, a hit, the dice and the cube.
88
- - **English and Japanese** in the board's words and the demo.
90
+ - **English, Japanese and French** in the board's words; English and Japanese in the demo.
89
91
  - **No dependencies**, no network requests, and nothing stored outside the page it is in.
90
92
 
91
93
  ### What's in it
@@ -685,7 +687,7 @@ element.addEventListener("sugoroku-turn", (event) => console.log(event.detail.no
685
687
 
686
688
  Tap a checker and then a point (the places it may go light up), or drag it there. A turn may
687
689
  be undone move by move until Done. The doubling cube is offered, taken and dropped with
688
- buttons. The computer plays either side. Words are in English and Japanese and follow the
690
+ buttons. The computer plays either side. Words are in English, Japanese and French and follow the
689
691
  page's `lang`.
690
692
 
691
693
  - **Dice** are rolled by a button, or (`dice: "host"`) given by the page: it hears
@@ -838,7 +840,7 @@ Any browser with ES2020 modules, custom elements, Pointer Events, `ResizeObserve
838
840
 
839
841
  ## Languages
840
842
 
841
- English and Japanese, chosen by the `lang` of the board's element or the page's, and followed when it changes. The demo has a chooser of its own and takes the browser's language on a first visit. The board's words (`SUGOROKU_STRINGS`) are in both. **Japanese: included; not yet reviewed by a native reader. Corrections welcome.** Every string of the board is listed beside its English in [docs/strings-ja.md](./docs/strings-ja.md), and there is an [issue template](https://github.com/johnmorrisdotca/sugoroku/issues/new?template=fix-a-translation.md) for fixing one. Any other language is a table of your own. The rules' notation is the standard one (`24/18 13/11`) in either.
843
+ English, Japanese and French, chosen by the `lang` of the board's element or the page's (any `fr-*` tag is French), and followed when it changes. The demo has a chooser of its own for English and Japanese and takes the browser's language on a first visit; its builder and embed page also offer French. The board's words (`SUGOROKU_STRINGS`) are in all three. **Japanese and French: included; not yet reviewed by a native reader. Corrections welcome.** Every string of the board is listed beside its English in [docs/strings-ja.md](./docs/strings-ja.md) and [docs/strings-fr.md](./docs/strings-fr.md), and there is an [issue template](https://github.com/johnmorrisdotca/sugoroku/issues/new?template=fix-a-translation.md) for fixing one. Any other language is a table of your own. The rules' notation is the standard one (`24/18 13/11`) in each.
842
844
 
843
845
  ## Roadmap
844
846
 
@@ -971,7 +973,7 @@ Please follow the [code of conduct](./CODE_OF_CONDUCT.md). A record or a positio
971
973
 
972
974
  See [CHANGELOG.md](./CHANGELOG.md).
973
975
 
974
- The latest release, 1.1.1, changes nothing a player sees.
976
+ The latest release, 1.2.1, corrects two French lines about the doubling cube.
975
977
 
976
978
  ## Licence
977
979
 
package/dist/element.js CHANGED
@@ -340,7 +340,7 @@ export class SugorokuBoard extends SugorokuFrame {
340
340
  }
341
341
  #look() {
342
342
  const view = this.getAttribute("view");
343
- const language = oneOf(this.getAttribute("lang"), ["en", "ja"]) ?? this.#options.language;
343
+ const language = oneOf(this.getAttribute("lang"), ["en", "ja", "fr"]) ?? this.#options.language;
344
344
  return {
345
345
  board: oneOf(this.getAttribute("board"), SUGOROKU_BOARD_NAMES) ?? this.#options.board,
346
346
  checkers: oneOf(this.getAttribute("checkers"), SUGOROKU_CHECKER_SET_NAMES) ??
@@ -264,7 +264,7 @@ export class SugorokuPosition extends SugorokuFrame {
264
264
  : "landscape",
265
265
  label: this.getAttribute("label") ??
266
266
  this.#options.label ??
267
- ((this.getAttribute("lang") ?? this.ownerDocument.documentElement.lang) === "ja" ? "双六の局面" : undefined),
267
+ { ja: "双六の局面", fr: "Position de backgammon" }[(this.getAttribute("lang") ?? this.ownerDocument.documentElement.lang).slice(0, 2)],
268
268
  style: this.#options.style ?? true,
269
269
  };
270
270
  const svg = new DOMParser().parseFromString(drawSugoroku(position, draw), "image/svg+xml").documentElement;
@@ -0,0 +1,2 @@
1
+ /** Sugoroku's words in French: the same names as the English table in `strings.ts`. A line that may name "you" puts the side first, before a colon, so no verb has to agree with it. */
2
+ export declare const FR: Record<string, string>;
@@ -0,0 +1,60 @@
1
+ /** Sugoroku's words in French: the same names as the English table in `strings.ts`. A line that may name "you" puts the side first, before a colon, so no verb has to agree with it. */
2
+ export const FR = {
3
+ variant_backgammon: "Backgammon",
4
+ "variant_backgammon-race": "Backgammon, course",
5
+ "variant_anti-backgammon": "Anti-backgammon",
6
+ variant_nackgammon: "Nackgammon",
7
+ "variant_long-gammon": "Long Gammon",
8
+ variant_hypergammon: "Hypergammon",
9
+ variant_tabula: "Tabula",
10
+ white: "Blanc",
11
+ black: "Noir",
12
+ computer: "Ordinateur",
13
+ you: "Vous",
14
+ board: "Plateau\u00a0: {variant}",
15
+ roll: "Lancer les dés",
16
+ rollOpening: "Lancer pour commencer",
17
+ done: "Terminé",
18
+ undo: "Annuler",
19
+ double: "Doubler",
20
+ take: "Accepter",
21
+ drop: "Refuser",
22
+ beaver: "Beaver",
23
+ nextGame: "Partie suivante",
24
+ newMatch: "Nouveau match",
25
+ waitingDice: "En attente des dés",
26
+ opening: "Lancez les dés\u00a0: le dé le plus haut commence.",
27
+ openingTie: "Égalité, {die} chacun. Relancez.",
28
+ started: "Premier à jouer\u00a0: {side}, avec {dice}.",
29
+ toRoll: "À {side} de lancer.",
30
+ toRollYou: "À vous de lancer.",
31
+ toPlay: "À {side} de jouer\u00a0: {dice}.",
32
+ toPlayYou: "À vous de jouer\u00a0: {dice}.",
33
+ played: "Tour joué. Appuyez sur Terminé.",
34
+ noMove: "{side} ne peut pas jouer.",
35
+ noMoveYou: "Aucun coup possible. Appuyez sur Terminé.",
36
+ thinking: "{side} réfléchit…",
37
+ doubled: "{side}\u00a0: videau doublé à {value}.",
38
+ answerDouble: "{side} double le videau à {value}. Accepter, ou refuser et perdre {points}?",
39
+ beavered: "{side}\u00a0: beaver, le videau passe à {value}.",
40
+ answerBeaver: "{side} fait un beaver\u00a0: le videau passe à {value}. Accepter, ou refuser et perdre {points}?",
41
+ tookDouble: "{side}\u00a0: doublement accepté, le videau est à {value}.",
42
+ singleGame: "une partie simple",
43
+ gammon: "un gammon",
44
+ backgammon: "un backgammon",
45
+ wonBy: "Gagnant\u00a0: {side}, {kind}. {points}.",
46
+ wonDrop: "Gagnant\u00a0: {side}, le doublement a été refusé. {points}.",
47
+ wonConcede: "Gagnant\u00a0: {side}, l'adversaire a abandonné. {points}.",
48
+ drawn: "La partie est nulle.",
49
+ point: "{n} point",
50
+ points: "{n} points",
51
+ matchWon: "Gagnant du match\u00a0: {side}, {a} à {b}.",
52
+ matchDrawn: "Le match est nul.",
53
+ score: "{white} {a}, {black} {b}",
54
+ matchTo: "match en {points}",
55
+ money: "partie libre",
56
+ crawford: "Partie Crawford\u00a0: pas de videau",
57
+ cubeMiddle: "videau au centre",
58
+ cubeHeld: "videau {value}, propriétaire\u00a0: {side}",
59
+ dice: "dés {dice}",
60
+ };
package/dist/strings.d.ts CHANGED
@@ -15,8 +15,8 @@
15
15
  * console.log(value);
16
16
  * ```
17
17
  */
18
- export type SugorokuLanguage = "en" | "ja";
19
- /** The native English and Japanese labels, announcements and interpolation templates.
18
+ export type SugorokuLanguage = "en" | "ja" | "fr";
19
+ /** The native English, Japanese and French labels, announcements and interpolation templates.
20
20
  *
21
21
  * @example
22
22
  * ```ts
@@ -39,10 +39,10 @@ export declare const SUGOROKU_STRINGS: Record<SugorokuLanguage, Record<string, s
39
39
  * ```
40
40
  */
41
41
  export declare function sugorokuSay(language: SugorokuLanguage, key: string, values?: Record<string, string | number>): string;
42
- /** The language an element or its page is in: its own `lang`, or the nearest above, and English unless that begins with `ja`.
42
+ /** The language an element or its page is in: its own `lang`, or the nearest above, Japanese if that begins with `ja`, French if `fr`, and English otherwise.
43
43
  *
44
44
  * @param element - The host element whose inherited language is read; null selects the fallback.
45
- * @returns The language an element or its page is in: its own `lang`, or the nearest above, and English unless that begins with `ja`.
45
+ * @returns The language an element or its page is in: its own `lang`, or the nearest above, Japanese if that begins with `ja`, French if `fr`, and English otherwise.
46
46
  * @example
47
47
  * ```ts no-run
48
48
  * import { sugorokuLanguageOf } from "@johnmorrisdotca/sugoroku/play";
package/dist/strings.js CHANGED
@@ -1,4 +1,5 @@
1
- /** The native English and Japanese labels, announcements and interpolation templates.
1
+ import { FR } from "./strings-fr.data.js";
2
+ /** The native English, Japanese and French labels, announcements and interpolation templates.
2
3
  *
3
4
  * @example
4
5
  * ```ts
@@ -125,6 +126,7 @@ export const SUGOROKU_STRINGS = {
125
126
  cubeHeld: "キューブ{value}({side})",
126
127
  dice: "サイコロ {dice}",
127
128
  },
129
+ fr: FR,
128
130
  };
129
131
  /** A line in a language with its `{name}`s filled in. A name left unfilled stays as written, so a missing value is visible.
130
132
  *
@@ -143,10 +145,10 @@ export function sugorokuSay(language, key, values = {}) {
143
145
  const line = SUGOROKU_STRINGS[language][key] ?? SUGOROKU_STRINGS.en[key] ?? key;
144
146
  return line.replace(/\{(\w+)\}/g, (whole, name) => (name in values ? String(values[name]) : whole));
145
147
  }
146
- /** The language an element or its page is in: its own `lang`, or the nearest above, and English unless that begins with `ja`.
148
+ /** The language an element or its page is in: its own `lang`, or the nearest above, Japanese if that begins with `ja`, French if `fr`, and English otherwise.
147
149
  *
148
150
  * @param element - The host element whose inherited language is read; null selects the fallback.
149
- * @returns The language an element or its page is in: its own `lang`, or the nearest above, and English unless that begins with `ja`.
151
+ * @returns The language an element or its page is in: its own `lang`, or the nearest above, Japanese if that begins with `ja`, French if `fr`, and English otherwise.
150
152
  * @example
151
153
  * ```ts no-run
152
154
  * import { sugorokuLanguageOf } from "@johnmorrisdotca/sugoroku/play";
@@ -160,5 +162,6 @@ export function sugorokuLanguageOf(element) {
160
162
  const tag = element?.closest("[lang]")?.getAttribute("lang") ??
161
163
  element?.ownerDocument?.documentElement.getAttribute("lang") ??
162
164
  "en";
163
- return tag.toLowerCase().startsWith("ja") ? "ja" : "en";
165
+ const lower = tag.toLowerCase();
166
+ return lower.startsWith("ja") ? "ja" : lower.startsWith("fr") ? "fr" : "en";
164
167
  }
package/dist/version.d.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  * console.log(VERSION);
7
7
  * ```
8
8
  */
9
- export declare const VERSION = "1.1.1";
9
+ export declare const VERSION = "1.2.1";
package/dist/version.js CHANGED
@@ -6,4 +6,4 @@
6
6
  * console.log(VERSION);
7
7
  * ```
8
8
  */
9
- export const VERSION = "1.1.1";
9
+ export const VERSION = "1.2.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/sugoroku",
3
- "version": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "description": "Sugoroku 双六 — Backgammon and its variants: native rules, doubling cube, match play, Long Gammon, Nackgammon, Hypergammon and Tabula, replayable records, computer players and an SVG board. TypeScript, zero dependencies.",
5
5
  "keywords": [
6
6
  "backgammon",