@intlpullhq/cli 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.
- package/README.md +48 -0
- package/dist/index.js +680 -922
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -744,11 +744,59 @@ Created by `intlpull init`, this file configures your project:
|
|
|
744
744
|
"framework": "next",
|
|
745
745
|
"library": "next-intl",
|
|
746
746
|
"outputDir": "./messages",
|
|
747
|
+
"output": "messages/[locale]/[namespace].json",
|
|
747
748
|
"sourceLanguage": "en",
|
|
748
749
|
"namespaces": ["common", "admin"]
|
|
749
750
|
}
|
|
750
751
|
```
|
|
751
752
|
|
|
753
|
+
### Output Patterns (Namespace Support)
|
|
754
|
+
|
|
755
|
+
The CLI supports flexible output patterns with placeholders to match any i18n library structure.
|
|
756
|
+
|
|
757
|
+
**Placeholders:**
|
|
758
|
+
- `[locale]` or `{locale}` - Language code (e.g., `en`, `es`, `zh-CN`)
|
|
759
|
+
- `[namespace]` or `{namespace}` - Namespace name (e.g., `common`, `auth`)
|
|
760
|
+
|
|
761
|
+
**Common Patterns by Framework:**
|
|
762
|
+
|
|
763
|
+
| Framework/Library | Pattern | Example Output |
|
|
764
|
+
|------------------|---------|----------------|
|
|
765
|
+
| **next-intl** | `messages/[locale].json` | `messages/en.json` |
|
|
766
|
+
| **next-i18next** | `public/locales/[locale]/[namespace].json` | `public/locales/en/common.json` |
|
|
767
|
+
| **react-i18next** | `public/locales/[locale]/[namespace].json` | `public/locales/en/auth.json` |
|
|
768
|
+
| **i18next** | `locales/[locale]/[namespace].json` | `locales/en/common.json` |
|
|
769
|
+
| **vue-i18n** | `src/locales/[locale].json` | `src/locales/en.json` |
|
|
770
|
+
| **Chrome Extension** | `_locales/[locale]/messages.json` | `_locales/en/messages.json` |
|
|
771
|
+
| **React Native** | `assets/locales/[locale]/[namespace].json` | `assets/locales/en/common.json` |
|
|
772
|
+
|
|
773
|
+
**Configure via CLI flag:**
|
|
774
|
+
```bash
|
|
775
|
+
# Namespaced output (creates separate files per namespace)
|
|
776
|
+
npx @intlpullhq/cli pull --output "public/locales/[locale]/[namespace].json"
|
|
777
|
+
|
|
778
|
+
# Flat output (merges all namespaces into one file)
|
|
779
|
+
npx @intlpullhq/cli pull --output "messages/[locale].json"
|
|
780
|
+
|
|
781
|
+
# Namespace-first structure
|
|
782
|
+
npx @intlpullhq/cli pull --output "locales/[namespace]/[locale].json"
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
**Configure in `.intlpull.json`:**
|
|
786
|
+
```json
|
|
787
|
+
{
|
|
788
|
+
"projectId": "proj_xxxx",
|
|
789
|
+
"output": "public/locales/[locale]/[namespace].json"
|
|
790
|
+
}
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
**Important:** Ensure your i18n library's configuration matches the output path:
|
|
794
|
+
|
|
795
|
+
- **next-intl**: Update `src/i18n/request.ts` to load from the correct path
|
|
796
|
+
- **i18next / react-i18next**: Update `backend.loadPath` in your i18n config
|
|
797
|
+
- **Chrome Extension**: Must use `_locales/[locale]/messages.json` (Chrome requirement)
|
|
798
|
+
```
|
|
799
|
+
|
|
752
800
|
### Environment Variables
|
|
753
801
|
|
|
754
802
|
| Variable | Description |
|