Skip to content

Commit

Permalink
dict: update smudge table for bg for new keepwords
Browse files Browse the repository at this point in the history
Signed-off-by: Jiang Xin <[email protected]>
  • Loading branch information
jiangxin committed Feb 13, 2024
1 parent d872873 commit 41c851b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
28 changes: 16 additions & 12 deletions dict/smudge-bg.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ func init() {
Pattern: "———",
Replace: "---",
},
{
Pattern: "…",
Replace: "...",
},

// Revert translated email address
{
Expand All @@ -90,6 +94,14 @@ func init() {
Replace: "[email protected]",
},

/*
* Add "<>" markers for param1 and param2
*/
{
Pattern: "files,ПАРАМЕТЪР_1,ПАРАМЕТЪР_2",
Replace: "files,<ПАРАМЕТЪР_1>,<ПАРАМЕТЪР_2>",
},

/*
* The <place-holder> in format string was translated without "<>", e.g.:
*
Expand Down Expand Up @@ -133,21 +145,13 @@ func init() {
* msgid "git restore [<...>] [--source=<...>] <file>..."
* msgstr "git restore [ОПЦИЯ…] [--source=КЛОН] ФАЙЛ…"
*
* We will get the keep words as follows from patten defined in KeepWordsPattern.
*
* msgid: --source=
* msgstr: --source=K
* Use the pattern below, we can rewrite "--source=КЛОН" in msgstr to:
*
* This will cause false positive report of typos. Hack as follows:
* --source=<...>
*/
{
Pattern: regexp.MustCompile(`(--[^\s]+=)<\.\.\.>`),
Replace: "$1 ...",
Reverse: true,
},
{
Pattern: regexp.MustCompile(`(--[^\s]+=)([a-zA-Z-]*[^a-zA-Z0-9\s-"]+[a-zA-Z0-9-]*)`),
Replace: "$1 $2",
Pattern: regexp.MustCompile(`(--[a-zA-Z0-9-]+)=([a-zA-Z0-9-]*[^a-zA-Z0-9<>\[\]()%\s"',*-]+[^<>\[\]()%\s"',*]*)`),
Replace: "$1=<...>",
},

/*
Expand Down
4 changes: 2 additions & 2 deletions test/t0037-typos-in-bg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ level=warning msg="[po/bg.po] mismatched patterns: --raw, --stat"
level=warning msg="[po/bg.po] >> msgid: synonym for '-p --raw'"
level=warning msg="[po/bg.po] >> msgstr: псевдоним на „-p --stat“"
level=warning msg="[po/bg.po]"
level=warning msg="[po/bg.po] mismatched patterns: --dirstat=, --dirstat=files"
level=warning msg="[po/bg.po] mismatched patterns: --dirstat=<...>,, --dirstat=files,param1,param2..."
level=warning msg="[po/bg.po] >> msgid: synonym for --dirstat=files,param1,param2..."
level=warning msg="[po/bg.po] >> msgstr: псевдоним на „--dirstat=ФАЙЛОВЕ,ПАРАМЕТЪР_1,ПАРАМЕТЪР_2,…“"
level=warning msg="[po/bg.po]"
Expand Down Expand Up @@ -265,7 +265,7 @@ test_expect_success "still has typos in master branch" '
level=error msg="[po/bg.po] >> msgid: git bundle create [<options>] <file> <git-rev-list args>"
level=error msg="[po/bg.po] >> msgstr: git bundle create [ОПЦИЯ…] ФАЙЛ АРГУМЕНТ_ЗА_git_rev-list…"
level=error msg="[po/bg.po]"
level=error msg="[po/bg.po] mismatched patterns: --dirstat=, --dirstat=files"
level=error msg="[po/bg.po] mismatched patterns: --dirstat=<...>,, --dirstat=files,param1,param2..."
level=error msg="[po/bg.po] >> msgid: synonym for --dirstat=files,param1,param2..."
level=error msg="[po/bg.po] >> msgstr: псевдоним на „--dirstat=ФАЙЛ…,ПАРАМЕТЪР_1,ПАРАМЕТЪР_2,…“"
level=error msg="[po/bg.po]"
Expand Down

0 comments on commit 41c851b

Please sign in to comment.