Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
9630b70
Add format
bearfriend Sep 6, 2024
bc7dca1
Cleanup terminology, grammar, etc.
bearfriend Sep 6, 2024
5c0cd39
Throw on error
bearfriend Sep 17, 2024
504bf97
Add trim and collapse; Move translator-output to print-missing subcom…
bearfriend Sep 17, 2024
e6432f8
Fix output order
bearfriend Sep 17, 2024
300a037
Add trim and collapse options
bearfriend Sep 18, 2024
adef608
Add format tests
bearfriend Sep 18, 2024
a2b6708
Fix lint and tests
bearfriend Sep 18, 2024
ca4ca04
Add more format tests and improvements to make them pass
bearfriend Sep 18, 2024
6226ead
"string" -> "message"
bearfriend Sep 18, 2024
6b2b3aa
Use @formatjs/icu-messageformat-parser in the validator
bearfriend Sep 19, 2024
26cc12d
Use Intl.PluralRules in validate
bearfriend Sep 19, 2024
3759129
Add utils
bearfriend Sep 19, 2024
96f0b8a
Add nested category tests
bearfriend Sep 19, 2024
e1e68f0
Use tabs for indentation
bearfriend Sep 19, 2024
8486467
Prevent exit code when errors are ignored
bearfriend Sep 19, 2024
6371a07
Tidy error names and messages
bearfriend Sep 19, 2024
2b72aca
Build required cldr data; cldr to devDependencies
bearfriend Sep 19, 2024
3eb729f
Move find-config to utils
bearfriend Sep 20, 2024
be733d2
Add build script
bearfriend Sep 20, 2024
9571530
Locales config as array
bearfriend Sep 20, 2024
d009584
Prevent double build on install
bearfriend Sep 20, 2024
09f07f6
Cleanup
bearfriend Sep 20, 2024
063d9ae
Rework duplicate error
bearfriend Sep 20, 2024
1e26318
Lots of stuff
bearfriend Dec 5, 2024
59c4182
Handle fr-on data
bearfriend Dec 5, 2024
ddbf1da
Add starting locale-data file
bearfriend Dec 6, 2024
3f28d08
Fix build path
bearfriend Dec 6, 2024
efa842d
Fix locale data
bearfriend Dec 9, 2024
c667e8f
Fix localesMap check
bearfriend Dec 9, 2024
55a5d2a
Clean up logging
bearfriend Dec 11, 2024
f92602f
Add "near: ..." to parse errors
bearfriend Dec 12, 2024
d1453a6
Fix async looping issues
bearfriend Dec 12, 2024
e1f5883
Fix escaping and quoting; Enable hash expansion
bearfriend Dec 13, 2024
044e75b
Actually fix escaping + cleanup
bearfriend Dec 13, 2024
cc4f52e
Improve arg finding
bearfriend Dec 13, 2024
f624e9c
Final escaping fix (hopefully)
bearfriend Dec 13, 2024
fac81e0
Improve argument correction
bearfriend Dec 13, 2024
534b26d
Add arg correction option
bearfriend Dec 13, 2024
88838df
Indicate path glob support
bearfriend Dec 13, 2024
1ff2a65
Fix escaped arg regex
bearfriend Dec 14, 2024
28f332f
Improve argument correction
bearfriend Jan 28, 2025
2516a0d
3.0.0-beta.0
bearfriend Jan 29, 2025
27bec45
3.0.0-beta.1
bearfriend Feb 3, 2025
20af6d6
Indent multiline templates beyond their keys
bearfriend Feb 4, 2025
df90294
Add apostophe character to delimiters
bearfriend Feb 4, 2025
fd2aa10
Handle apostophes with pure cldr data
bearfriend Feb 4, 2025
76c14e6
Add haw quote test
bearfriend Feb 4, 2025
ab88455
3.0.0-beta.2
bearfriend Feb 4, 2025
7e95b24
Fix case match argument correction
bearfriend Mar 22, 2025
8adfe4c
3.0.0-beta.3
bearfriend Mar 22, 2025
d0aa746
Escape quotes as necessary
bearfriend May 23, 2025
961a1b1
3.0.0-beta.4
bearfriend May 23, 2025
1f7c195
Unescape quotes before formatting
bearfriend May 23, 2025
f2d1d57
3.0.0-beta.5
bearfriend May 23, 2025
876daea
Export structureRegEx and formatMessage
bearfriend Jun 3, 2025
af0c2e4
Improve structureRegEx to handle escapes better (but not perfectly)
bearfriend Jun 4, 2025
c9f6218
Fix indentation when not using -n
bearfriend Jun 5, 2025
fe126b8
3.0.0-beta.6
bearfriend Jun 5, 2025
f414ffa
3.0.0-beta.7
bearfriend Jun 5, 2025
13afe41
Fix unicode regex
bearfriend Jun 6, 2025
997157a
Fix file writing
bearfriend Jun 6, 2025
69dacb2
Sort . above everything else
bearfriend Jun 8, 2025
38cae66
Fix exit code
bearfriend Jun 9, 2025
11d3f7a
Do not hoist with trim enabled
bearfriend Jun 9, 2025
d131d54
3.0.0-beta.8
bearfriend Jun 9, 2025
2392dcf
Add Thai and Vietnamese as default locales
bearfriend Jun 9, 2025
5f94965
Fix writes more
bearfriend Jun 9, 2025
dd3df25
Fix print-missing
bearfriend Jun 9, 2025
1b8e7af
3.0.0-beta.9
bearfriend Jun 9, 2025
968c80b
Fix source quotes
bearfriend Jun 10, 2025
c47d73c
3.0.0-beta.10
bearfriend Jun 10, 2025
0e85064
Fix hash replacements
bearfriend Jun 19, 2025
dfbc96b
3.0.0-beta.11
bearfriend Jun 19, 2025
f23142b
Fix sorting comma handling
bearfriend Jun 20, 2025
d56f349
3.0.0-beta.12
bearfriend Jun 20, 2025
3896ace
Handle comments properly when checking comma for sort
bearfriend Jun 20, 2025
608a148
3.0.0-beta.13
bearfriend Jun 20, 2025
0e56cb0
Convert English source "=1" cases to "one" if only basic plural diffe…
bearfriend Jun 25, 2025
40dca55
3.0.0-beta.14
bearfriend Jun 26, 2025
b8dff77
Fix erroneous =1 swapping
bearfriend Jan 12, 2026
51939d2
3.0.0-beta.15
bearfriend Jan 12, 2026
f636453
Fix argument checking in additional plural categories
bearfriend Jan 12, 2026
f34c7c0
3.0.0-beta.16
bearfriend Jan 12, 2026
44a595c
Improve apostrophe tests
bearfriend Mar 4, 2026
30b1a5c
Fix apostrophe recognition/escaping
bearfriend Mar 4, 2026
451cb8b
Fic double backslash value parsing
bearfriend Mar 4, 2026
dc50a14
3.0.0-beta.17
bearfriend Mar 5, 2026
7d6d263
Update README
bearfriend Mar 5, 2026
8dc3420
Remove rebase artifact
bearfriend Mar 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
"@babel/plugin-syntax-import-attributes"
]
}
},
"rules": {
"indent": ["error", "tab"]
}
}
51 changes: 31 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ Output the `myMessage` message from the `es-es` file with all messageformat stru
mfv -l es-es -p lang/ highlight myMessage
```

Re-write messages to a standard format, using newlines and tabs for complex arguments, and removing any plural categories that are invalid for each locale (e.g. `zero` for English, `one` for Korean)
```shell
mfv -s en -p lang/ format -nr
```

### Options:

`-V, --version` - output the version number

`-e, --throw-errors` - Throw an error if error issues are found

`--no-issues` - Don't output issues

`-i, --ignoreIssueTypes <items>` - Ignore these comma-separated issue types
`-i, --ignore <items>` - Ignore these comma-separated issue types

`-l, --locales <items>` - Process only these comma-separated locales

Expand All @@ -51,7 +54,7 @@ mfv -l es-es -p lang/ highlight myMessage

`--json-obj` - Indicate that the files to be parsed are JSON files with keys that have objects for values with their own keys: `translation` and `context`

`-h, --help` - display help for command
`-h, --help` - Display help for command

### Subommands:

Expand All @@ -65,7 +68,7 @@ mfv -l es-es -p lang/ highlight myMessage

`highlight <key>` - Output a message with all non-translatable ICU MessageFormat structure highlighted

`help [command]` - display help for command
`format` - Rewrite messages to a standard format

## Config File

Expand All @@ -74,39 +77,47 @@ Some options can be configured with default values in `mfv.config.json`
{
"source": "en"
"path": "lang/",
"locales": "ar,de,en,es,es-es,hi,tr",
"locales": ["ar", "de", "en", "es", "es-es", "hi", "tr"],
"jsonObj": true
}
```

## Errors

`argument` - There are unrecognized arguments in the target message.
`argument` - Unrecognized argument

`brace` - There are mismatched braces in the target message.
`brace` - Mismatched braces

`case` - There are unrecognized cases in the target message.
`category` - Unsupported category

`extraneous` - There is an extraneous message in the target locale.
`duplicate` - Multiple messages with the same name

`missing` - There is a message missing from the target locale.
`extraneous` - Message does not exist in the source locale

`nbsp` - There are invalid non-breaking spaces in the structure of the target message.
`missing` - Message missing from the target locale

`nest` - The nesting order of the target message does not match the source message.
`nbsp` - Message structure contains non-breaking space

`other` - The target message is missing an `other` case
`nest` - The nesting order of the target message does not match the source message

`parse` - The target message can not be parsed.
`option` - Unrecognized option

`source` - There is an error in the source message.
`option-missing` - Missing option used in the source

`other` - Missing "other" option

`parse` - Failed to parse message

`source` - Failed to parse source message

## Warnings

`categories` - The target message is missing plural categories used in the target locale
`category-missing` - Missing categories used by the target locale

`nest-ideal` - A `select` is nested inside a `plural` or `selectordinal`

`nest` - There is a `select` nested inside a `plural` or `selectordinal` in the target message.
`nest-order` - Nesting order does not match source

`split` - The target message is split by a non-argument. `plural`, `selectordinal`, and `select` cases should contain complete translations.
`split` - Split by a complex argument

`untranslated` - The target message has not been translated.
`untranslated` - Message has not been translated
Loading