-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dict/bg: Smudge both msgId and msgStr
We used to define a large smudge table for bg (Bulgarian) language, because in git bg l10n translations, "<place-holder>" was translated without the surrounding quotes "<>". Add new field for smudge table, so we can smudge both msgID and msgStr for bg translations, to suppress unnecessary warnings. Signed-off-by: Jiang Xin <[email protected]>
- Loading branch information
Showing
5 changed files
with
122 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,42 @@ | ||
package dict | ||
|
||
import "regexp" | ||
|
||
func init() { | ||
SmudgeMaps["bg"] = []SmudgeMap{ | ||
/* | ||
* In bg translations, additional "git" command name is added before | ||
* subcommand, revert these changes before checking typos. | ||
*/ | ||
{ | ||
Pattern: "———", | ||
Replace: "---", | ||
}, | ||
|
||
// Not keep symbols "<" and ">", the reason is ? | ||
{ | ||
Pattern: "РЕГУЛЯРЕН_ИЗРАЗ", | ||
Replace: "<РЕГУЛЯРЕН_ИЗРАЗ>", | ||
}, | ||
{ | ||
Pattern: "ДИРЕКТОРИЯ", | ||
Replace: "<ДИРЕКТОРИЯ>", | ||
}, | ||
{ | ||
Pattern: "ПАКЕТЕН_ФАЙЛ", | ||
Replace: "<ПАКЕТЕН_ФАЙЛ>", | ||
}, | ||
{ | ||
Pattern: "align:ШИРОЧИНА,ПОЗИЦИЯ", | ||
Replace: "align:<ШИРОЧИНА>,<ПОЗИЦИЯ>", | ||
}, | ||
{ | ||
Pattern: "color:ЦВЯТ", | ||
Replace: "color:<ЦВЯТ>", | ||
}, | ||
{ | ||
Pattern: "--config=НАСТРОЙКА", | ||
Replace: "--config=<НАСТРОЙКА>", | ||
}, | ||
{ | ||
Pattern: "--prefix=ПРЕФИКС", | ||
Replace: "--prefix=<ПРЕФИКС>", | ||
}, | ||
{ | ||
Pattern: "--index-output=ФАЙЛ", | ||
Replace: "--index-output=<ФАЙЛ>", | ||
}, | ||
{ | ||
Pattern: "--extcmd=КОМАНДА", | ||
Replace: "--extcmd=<КОМАНДА>", | ||
}, | ||
{ | ||
Pattern: "--tool=ПРОГРАМА", | ||
Replace: "--tool=<ПРОГРАМА>", | ||
}, | ||
{ | ||
Pattern: "--schedule=ЧЕСТОТА", | ||
Replace: "--schedule=<ЧЕСТОТА>", | ||
Pattern: "Командата „git pack-objects“", | ||
Replace: "spawn pack-objects", | ||
}, | ||
{ | ||
Pattern: "trailers:key=ЕПИЛОГ", | ||
Replace: "trailers:key=<ЕПИЛОГ>", | ||
Pattern: "„git-difftool“ изисква работно дърво или опцията „--no-index“", | ||
Replace: "difftool requires worktree or --no-index", | ||
}, | ||
|
||
// Upstream may need to add "<>" around "files" | ||
{ | ||
Pattern: "--dirstat=ФАЙЛОВЕ", | ||
Replace: "--dirstat=files", | ||
Pattern: "командата „git index-pack“ не завърши успешно", | ||
Replace: "index-pack died", | ||
}, | ||
{ | ||
Pattern: "--dirstat=ФАЙЛ…,ПАРАМЕТЪР_1,ПАРАМЕТЪР_2,", | ||
Replace: "--dirstat=files,param1,param2", | ||
Pattern: "Командата „git pack-objects“ не завърши успешно", | ||
Replace: "pack-objects died", | ||
}, | ||
|
||
// Email address | ||
{ | ||
Pattern: "ИМЕ@example.com", | ||
Replace: "[email protected]", | ||
Pattern: "указателят „%s“ не е бил включен поради опциите зададени на „git rev-list“", | ||
Replace: "ref '%s' is excluded by the rev-list options", | ||
}, | ||
{ | ||
Pattern: "пенчо@example.com", | ||
Replace: "[email protected]", | ||
Pattern: " git merge-base --fork-point", | ||
Replace: " merge-base --fork-point", | ||
}, | ||
|
||
// add or lost '--' | ||
/* | ||
* In bg translations, add additional "--" characters before command option, | ||
* but the original msgid does not have. | ||
*/ | ||
{ | ||
Pattern: "неправилен параметър към опцията „--update“", | ||
Replace: "bad value for update parameter", | ||
|
@@ -94,8 +53,10 @@ func init() { | |
Pattern: "„%s“ към опцията „--ancestry-path", | ||
Replace: "ancestry-path argument %s", | ||
}, | ||
|
||
// Upstream should add "--" ? | ||
{ | ||
Pattern: "Неправилен режим за „--rebase-merges“: %s", | ||
Replace: "Unknown rebase-merges mode: %s", | ||
}, | ||
{ | ||
Pattern: "не поддържа опцията „--force“", | ||
Replace: "does not support 'force'", | ||
|
@@ -105,40 +66,88 @@ func init() { | |
Replace: "unknown mirror argument: %s", | ||
}, | ||
|
||
// Add or lost "git" before subcommand | ||
{ | ||
Pattern: "Командата „git pack-objects“", | ||
Replace: "spawn pack-objects", | ||
}, | ||
// Revert changes in bg, such as quotes and dashes. | ||
{ | ||
Pattern: "„git-difftool“ изисква работно дърво или опцията „--no-index“", | ||
Replace: "difftool requires worktree or --no-index", | ||
Pattern: "„", | ||
Replace: "\"", | ||
}, | ||
{ | ||
Pattern: "командата „git index-pack“ не завърши успешно", | ||
Replace: "index-pack died", | ||
Pattern: "“", | ||
Replace: "\"", | ||
}, | ||
{ | ||
Pattern: "Командата „git pack-objects“ не завърши успешно", | ||
Replace: "pack-objects died", | ||
Pattern: "———", | ||
Replace: "---", | ||
}, | ||
|
||
// Revert translated email address | ||
{ | ||
Pattern: "указателят „%s“ не е бил включен поради опциите зададени на „git rev-list“", | ||
Replace: "ref '%s' is excluded by the rev-list options", | ||
Pattern: "ИМЕ@example.com", | ||
Replace: "[email protected]", | ||
}, | ||
{ | ||
Pattern: " git merge-base --fork-point", | ||
Replace: " merge-base --fork-point", | ||
Pattern: "пенчо@example.com", | ||
Replace: "[email protected]", | ||
}, | ||
|
||
// Quotes in bg | ||
{ | ||
Pattern: "„", | ||
Replace: "\"", | ||
/* | ||
* The <place-holder> in format string was translated without "<>", e.g.: | ||
* | ||
* msgid "expected format: %%(color:<color>)" | ||
* msgstr "очакван формат: %%(color:ЦВЯТ)" | ||
* | ||
* msgid "expected format: %%(align:<width>,<position>)" | ||
* msgstr "очакван формат: %%(align:ШИРОЧИНА,ПОЗИЦИЯ)" | ||
* | ||
* After replaced according to patterns defined in GlobalSkipPatterns, | ||
* the result are follow: | ||
* | ||
* msgid "expected format: %%(color:<...>)" | ||
* msgstr "очакван формат: %%(color:ЦВЯТ)" | ||
* | ||
* msgid "expected format: %%(align:<...>,<...>)" | ||
* msgstr "очакван формат: %%(align:ШИРОЧИНА,ПОЗИЦИЯ)" | ||
* | ||
* In oder to check the format strings in above messages, we define | ||
* several smudge maps as below. | ||
*/ | ||
{ | ||
Pattern: regexp.MustCompile(`(%%\([^\s\)]+?:([^\s\)]*?=)?).*?\)`), | ||
Replace: "$1)", | ||
Reverse: true, | ||
}, | ||
{ | ||
Pattern: regexp.MustCompile(`(%%\([^\s\)]+?:([^\s\)]*?=)?).*?\)`), | ||
Replace: "$1)", | ||
}, | ||
{ | ||
Pattern: "“", | ||
Replace: "\"", | ||
|
||
/* | ||
* The <place-holder>s in command options were translated in bg without "<>", e.g.: | ||
* | ||
* msgid "git restore [<options>] [--source=<branch>] <file>..." | ||
* msgstr "git restore [ОПЦИЯ…] [--source=КЛОН] ФАЙЛ…" | ||
* | ||
* After replaced according to patterns defined in GlobalSkipPatterns, | ||
* the result are follow: | ||
* | ||
* 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 | ||
* | ||
* This will cause false positive report of typos. Hack as follows: | ||
*/ | ||
{ | ||
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", | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ test-repository | |
*.swp | ||
test-results/ | ||
trash directory.*/ | ||
chainlinttmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters