Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
git-manpages-l10n
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
yun hwak byeon
git-manpages-l10n
Commits
b90323e5
Commit
b90323e5
authored
5 years ago
by
Jean-Noël Avila
Browse files
Options
Downloads
Plain Diff
Merge branch 'enhance_pre_translate'
parents
f30f88d7
dec7148b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/pre-translate-po
+17
-12
17 additions, 12 deletions
scripts/pre-translate-po
with
17 additions
and
12 deletions
scripts/pre-translate-po
+
17
−
12
View file @
b90323e5
...
...
@@ -4,28 +4,33 @@ import polib
import
re
import
sys
def
main
(
f
,
d
=
None
):
def
main
(
f
,
d
=
None
):
po
=
polib
.
pofile
(
f
,
wrapwidth
=
0
)
option_re
=
re
.
compile
(
r
'
-[-a-z0-9[\]]+
'
)
linkgit_re
=
re
.
compile
(
r
'
((linkgit:)?(git[-a-z0-9[\]]+|mail)(\[[157]\]|\([157]\))(,|;)?(\n| )?)+
'
)
quoted_re
=
re
.
compile
(
r
'
`[a-zA-Z-_]+`|(user|transfer|submodule|stash|status|splitIndex|showbranch|sendemail|repack|remote|receive|push|merge(tool)?|mailinfo|log|interactive|instaweb|i18n|help|gui|gitweb|fastimport|format|fetch|diff(tool)?|credential|commit|column|core|branch|apply|color|git-p4)\.[a-zA-Z_.]+|araxis|bc3?|codecompare|deltawalker|guiffy|meld|diff(use|merge)|ec?merge|(exam|g?vim|t?k|open|xx)?diff[23]?|(p4|tortoise|win)merge
'
)
env_var_re
=
re
.
compile
(
r
'
`?GIT_[A-Z_]+`?
'
)
if
not
d
is
None
:
po
d
=
polib
.
pofile
(
d
)
po
_file
=
polib
.
pofile
(
d
)
pod
=
[(
re
.
compile
(
entry
.
msgid
),
entry
.
msgstr
)
for
entry
in
po_file
]
for
entry
in
po
:
if
(
re
.
fullmatch
(
r
'
-[-a-z0-9[\]]+
'
,
entry
.
msgid
)
)
\
or
re
.
fullmatch
(
r
'
((linkgit:)?(git[-a-z0-9[\]]+|mail)(\[[157]\]|\([157]\))(,|;)?(\n| )?)+
'
,
entry
.
msgid
)
\
or
re
.
fullmatch
(
r
'
`[a-zA-Z-_]+`|(user|transfer|submodule|stash|status|splitIndex|showbranch|sendemail|repack|remote|receive|push|merge(tool)?|mailinfo|log|interactive|instaweb|i18n|help|gui|gitweb|fastimport|format|fetch|diff(tool)?|credential|commit|column|core|branch|apply|color|git-p4)\.[a-zA-Z_.]+|araxis|bc3?|codecompare|deltawalker|guiffy|meld|diff(use|merge)|ec?merge|(exam|g?vim|t?k|open|xx)?diff[23]?|(p4|tortoise|win)merge
'
,
entry
.
msgid
)
\
or
re
.
fullmatch
(
r
'
`?GIT_[A-Z_]+`?
'
,
entry
.
msgid
):
if
option_
re
.
fullmatch
(
entry
.
msgid
)
\
or
linkgit_
re
.
fullmatch
(
entry
.
msgid
)
\
or
quoted_re
.
fullmatch
(
entry
.
msgid
)
\
or
env_var_
re
.
fullmatch
(
entry
.
msgid
):
entry
.
msgstr
=
entry
.
msgid
entry
.
flags
.
append
(
"
ignore-same
"
)
flags
=
sorted
(
set
(
entry
.
flags
))
entry
.
flags
=
list
(
flags
)
remove_fuzzy
(
entry
)
elif
not
d
is
None
:
for
entry
d
in
pod
:
if
re
.
fullmatch
(
entryd
.
msgid
,
entry
.
msgid
):
entry
.
msgstr
=
re
.
sub
(
entryd
.
msgid
,
entryd
.
msgstr
,
entry
.
msgid
)
for
(
entry
re
,
entryrep
)
in
pod
:
if
entry
re
.
fullmatch
(
entry
.
msgid
):
entry
.
msgstr
=
entryre
.
sub
(
entryrep
,
entry
.
msgid
)
remove_fuzzy
(
entry
)
break
if
"
...
"
in
entry
.
msgid
:
entry
.
flags
=
list
(
sorted
(
set
(
entry
.
flags
+
[
"
ignore-ellipsis
"
])))
po
.
save
(
f
)
def
remove_fuzzy
(
entry
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment