genshin-text 4.3.3 → 4.4.0

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/README.md CHANGED
@@ -5,18 +5,16 @@
5
5
  [![NPM downloads][badge-npm-downloads]][url-npm]
6
6
  [![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
7
7
 
8
- Genshin Impact's own text in its fifteen languages, as an unofficial, non-commercial fan work and not affiliated with HoYoverse:
9
-
10
- - the game's languages, each with its BCP-47 tag and its own name for itself;
11
- - `matchGameLanguage`, the game language nearest a reader's browser locale or `Accept-Language` header;
12
- - every string the package references, looked up by the game's own text id, with English bundled and every other language a chunk loaded on first use.
8
+ Genshin Impact's own text in its fifteen languages, as an unofficial, non-commercial fan work and not affiliated with HoYoverse.
13
9
 
14
10
  Nothing is translated by hand: each string is the game's own, in the game's own translation.
15
11
 
12
+ Design notes live in [the specs](https://github.com/Esposter/Esposter/tree/main/openspec/specs/genshin/game-text).
13
+
16
14
  ## Table of Contents
17
15
 
18
16
  - 🚀 [Getting Started](#getting-started)
19
- - 📖 [Documentation](#documentation)
17
+ - 🧩 [Key Exports](#key-exports)
20
18
  - ⚖️ [License](#license)
21
19
 
22
20
  ---
@@ -32,14 +30,25 @@ Pick the reader's language, load its text once, and index it by key:
32
30
  ```ts
33
31
  import { GameTextKey, GameTextLoaderMap, matchGameLanguage } from "genshin-text";
34
32
 
35
- const language = matchGameLanguage(navigator.languages);
33
+ const language = matchGameLanguage(window.navigator.languages);
36
34
  const gameText = await GameTextLoaderMap[language]();
37
35
  console.log(gameText[GameTextKey.Loading]);
38
36
  ```
39
37
 
40
- ## <a name="documentation">📖 Documentation</a>
41
-
42
- We highly recommend you take a look at the [documentation](https://github.com/Esposter/Esposter/blob/main/openspec/specs/genshin/game-text/design.md) to level up. It explains where the text comes from and how to reference a new string.
38
+ ## <a name="key-exports">🧩 Key Exports</a>
39
+
40
+ | Export | Kind | Purpose |
41
+ | ------------------------ | --------- | ---------------------------------------------------------------------------------------------- |
42
+ | `fillGameTextValues` | function | Fills a string's numbered placeholders with the values given, keeping any with no value |
43
+ | `GameLanguage` | enum | The fifteen languages the game is written in |
44
+ | `GameText` | type | Every referenced string in one language, keyed by `GameTextKey` |
45
+ | `GameTextKey` | enum | Every string a consumer shows, by the game's own text id |
46
+ | `GameTextLoaderMap` | const | Loads one language's `GameText`: English bundled, every other language a chunk on first use |
47
+ | `GameTextSegment` | interface | A run of a game string under one colour, or plain when it has none |
48
+ | `getAcceptLanguageTags` | function | The tags of an `Accept-Language` header, most preferred first, weighed by their `q` |
49
+ | `getLanguageDisplayName` | function | A game language's name as written in another game language, or as given when either is not one |
50
+ | `matchGameLanguage` | function | The game language nearest a list of preferred tags, English when none matches |
51
+ | `splitGameTextColors` | function | Splits a game string into plain runs and colour-tagged runs |
43
52
 
44
53
  ## <a name="license">⚖️ License</a>
45
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genshin-text",
3
- "version": "4.3.3",
3
+ "version": "4.4.0",
4
4
  "description": "Genshin Impact's own text in its fifteen languages: the language registry, a matcher from a browser's locale, and the game's strings looked up by the game's own text id, one lazily loaded chunk per language.",
5
5
  "keywords": [
6
6
  "genshin",
@@ -43,14 +43,14 @@
43
43
  "lint": "eslint .",
44
44
  "lint:fix": "eslint --fix .",
45
45
  "test": "vitest",
46
- "typecheck": "tsc"
46
+ "typecheck": "tsrs --fast"
47
47
  },
48
48
  "dependencies": {
49
- "@esposter/shared": "4.3.3"
49
+ "@esposter/shared": "4.4.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@esposter/configuration": "4.3.3",
53
- "tsdown": "^0.23.1"
52
+ "@esposter/configuration": "4.4.0",
53
+ "tsdown": "0.23.2"
54
54
  },
55
- "gitHead": "955bbc130ad9b28877fd4ae8efc73a045141ce01"
55
+ "gitHead": "e1a416c4b91da69cc2aa259b50a4d656f204d272"
56
56
  }