@shipi18n/cli 1.1.2 → 1.1.3

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
@@ -97,6 +97,11 @@ shipi18n translate <input> [options]
97
97
  - `-o, --output <dir>` - Output directory (default: `./locales`)
98
98
  - `--api-key <key>` - API key (overrides config)
99
99
  - `--preserve-placeholders` - Preserve placeholders (default: `true`)
100
+ - `--html-handling <mode>` - How to handle HTML in source text (default: `none`)
101
+ - `none` - Leave HTML as-is
102
+ - `strip` - Remove all HTML tags
103
+ - `decode` - Decode HTML entities (`&amp;` → `&`)
104
+ - `preserve` - Keep HTML tags and translate text between them
100
105
  - `--no-fallback` - Disable fallback to source for missing translations
101
106
  - `--no-regional-fallback` - Disable regional fallback (e.g., pt-BR → pt)
102
107
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipi18n/cli",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Command-line tool for translating locale files with Shipi18n",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -15,6 +15,7 @@ export function translateCommand(program) {
15
15
  .option('-o, --output <dir>', 'Output directory', './locales')
16
16
  .option('--api-key <key>', 'API key (overrides config)')
17
17
  .option('--preserve-placeholders', 'Preserve placeholders like {name}, {{value}}, etc.', true)
18
+ .option('--html-handling <mode>', 'How to handle HTML in source text: none, strip, decode, preserve', 'none')
18
19
  .option('--no-fallback', 'Disable fallback to source language for missing translations')
19
20
  .option('--no-regional-fallback', 'Disable regional fallback (e.g., pt-BR -> pt)')
20
21
  .option('-i, --incremental', 'Only translate new/missing keys (skip existing translations)')
@@ -131,6 +132,7 @@ export function translateCommand(program) {
131
132
  sourceLanguage,
132
133
  targetLanguages,
133
134
  preservePlaceholders: options.preservePlaceholders,
135
+ htmlHandling: options.htmlHandling,
134
136
  fallback: {
135
137
  fallbackToSource: options.fallback !== false,
136
138
  regionalFallback: options.regionalFallback !== false,
package/src/lib/api.js CHANGED
@@ -19,6 +19,7 @@ export class Shipi18nAPI {
19
19
  * @param {string} options.sourceLanguage - Source language code
20
20
  * @param {string[]} options.targetLanguages - Target language codes
21
21
  * @param {boolean} options.preservePlaceholders - Preserve placeholders
22
+ * @param {string} options.htmlHandling - How to handle HTML: none, strip, decode, preserve
22
23
  * @param {Object} options.fallback - Fallback options
23
24
  * @param {boolean} options.fallback.fallbackToSource - Use source content when translation missing (default: true)
24
25
  * @param {boolean} options.fallback.regionalFallback - Enable pt-BR -> pt fallback (default: true)
@@ -29,6 +30,7 @@ export class Shipi18nAPI {
29
30
  sourceLanguage = 'en',
30
31
  targetLanguages,
31
32
  preservePlaceholders = true,
33
+ htmlHandling = 'none',
32
34
  fallback = {}
33
35
  }) {
34
36
  if (!this.apiKey) {
@@ -59,6 +61,7 @@ export class Shipi18nAPI {
59
61
  sourceLanguage,
60
62
  targetLanguages: JSON.stringify(processedTargets),
61
63
  preservePlaceholders: String(preservePlaceholders),
64
+ htmlHandling,
62
65
  }),
63
66
  });
64
67