graphile-i18n 0.1.6 โ†’ 0.1.7

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.
Files changed (2) hide show
  1. package/README.md +22 -9
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -16,15 +16,22 @@
16
16
  </a>
17
17
  </p>
18
18
 
19
- TypeScript rewrite of the Graphile/PostGraphile i18n plugin. Adds language-aware fields sourced from translation tables declared via smart comments.
19
+ **`graphile-i18n`** is a TypeScript rewrite of the Graphile/PostGraphile i18n plugin. It adds language-aware fields sourced from translation tables declared via smart comments and respects `Accept-Language` with sensible fallbacks.
20
20
 
21
- ## Install
21
+ ## ๐Ÿš€ Installation
22
22
 
23
23
  ```bash
24
24
  pnpm add graphile-i18n
25
25
  ```
26
26
 
27
- ## Usage
27
+ ## โœจ Features
28
+
29
+ - Smart comments (`@i18n`) to wire translation tables
30
+ - `Accept-Language` detection with graceful fallback to base values
31
+ - Works with PostGraphile context via `additionalGraphQLContextFromRequest`
32
+ - TypeScript-first implementation
33
+
34
+ ## ๐Ÿ“ฆ Usage
28
35
 
29
36
  1. Add a translation table and tag the base table with `@i18n`:
30
37
 
@@ -70,15 +77,21 @@ app.use(
70
77
 
71
78
  Requests with `Accept-Language` headers receive the closest translation; fields fall back to the base table values when a translation is missing.
72
79
 
73
- ## Tests
80
+ ## ๐Ÿงฐ Configuration Options
74
81
 
75
- Tests run against a real Postgres instance using `graphile-test`:
82
+ All options are provided through `graphileBuildOptions`:
76
83
 
77
- ```bash
78
- pnpm test
79
- ```
84
+ - `langPluginLanguageCodeColumn` โ€” translation table column name, default `lang_code`
85
+ - `langPluginLanguageCodeGqlField` โ€” exposed GraphQL field name, default `langCode`
86
+ - `langPluginAllowedTypes` โ€” allowed base column types for translation, default `['citext', 'text']`
87
+ - `langPluginDefaultLanguages` โ€” fallback language order, default `['en']`
88
+
89
+ ## ๐Ÿงช Testing
80
90
 
81
- Ensure Postgres is available at `postgres://postgres:password@localhost:5432`.
91
+ ```sh
92
+ # requires a local Postgres available (defaults to postgres/password@localhost:5432)
93
+ pnpm --filter graphile-i18n test
94
+ ```
82
95
 
83
96
  ---
84
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphile-i18n",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Graphile i18n plugin",
5
5
  "author": "Dan Lynch <pyramation@gmail.com>",
6
6
  "homepage": "https://github.com/launchql/launchql",
@@ -40,9 +40,9 @@
40
40
  "devDependencies": {
41
41
  "@types/accept-language-parser": "^1.5.4",
42
42
  "@types/pg": "^8.15.2",
43
- "graphile-test": "^2.8.10",
43
+ "graphile-test": "^2.8.11",
44
44
  "makage": "^0.1.8",
45
- "pgsql-test": "^2.14.13"
45
+ "pgsql-test": "^2.14.14"
46
46
  },
47
47
  "dependencies": {
48
48
  "accept-language-parser": "^1.5.0",
@@ -55,5 +55,5 @@
55
55
  "graphql-tag": "2.12.6",
56
56
  "pg": "^8.16.0"
57
57
  },
58
- "gitHead": "4e1ff9771c2b07808a9830281abc24d12c689187"
58
+ "gitHead": "00c90828cab8d3e306ebb2bc6053aab4aa9ae807"
59
59
  }