@gjsify/vite-plugin-gettext 0.4.43 → 0.4.44

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 +45 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # @gjsify/vite-plugin-gettext
2
+
3
+ Vite/Rollup/Rolldown plugin for gettext-based i18n in gjsify web and GJS apps. Compiles `.po` translation files to binary `.mo` format via `msgfmt`, extracts translatable strings via `xgettext`, and converts `.po` files to JSON for browser targets.
4
+
5
+ Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ gjsify install @gjsify/vite-plugin-gettext
11
+
12
+ # npm or yarn also work (e.g. adding it to an existing project):
13
+ npm install @gjsify/vite-plugin-gettext
14
+ yarn add @gjsify/vite-plugin-gettext
15
+ ```
16
+
17
+ Requires `gettext` tools (`msgfmt`, `xgettext`) to be installed on the system.
18
+
19
+ ## Usage
20
+
21
+ ```typescript
22
+ // vite.config.ts
23
+ import { defineConfig } from 'vite';
24
+ import { gettextPlugin, xgettextPlugin, po2jsonPlugin } from '@gjsify/vite-plugin-gettext';
25
+
26
+ export default defineConfig({
27
+ plugins: [
28
+ // Compile .po files → .mo (for GJS/GTK apps using Gettext.bindtextdomain)
29
+ gettextPlugin({
30
+ poDirectory: 'po',
31
+ moDirectory: 'dist/locale',
32
+ }),
33
+
34
+ // Convert .po → JSON (for browser targets)
35
+ po2jsonPlugin({
36
+ poDirectory: 'po',
37
+ outputDirectory: 'dist/i18n',
38
+ }),
39
+ ],
40
+ });
41
+ ```
42
+
43
+ ## License
44
+
45
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/vite-plugin-gettext",
3
- "version": "0.4.43",
3
+ "version": "0.4.44",
4
4
  "description": "Gettext PO/MO/JSON pipeline for Vite / Rollup / Rolldown — extract via xgettext, compile via msgfmt, JSON for browser targets.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",