Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
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
Container registry
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
bedce097
Commit
bedce097
authored
6 years ago
by
Bastien Montagne
Browse files
Options
Downloads
Patches
Plain Diff
UI Translate: add operator & button to cleanup branches.
parent
e3c9be92
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ui_translate/__init__.py
+1
-1
1 addition, 1 deletion
ui_translate/__init__.py
ui_translate/update_svn.py
+35
-4
35 additions, 4 deletions
ui_translate/update_svn.py
ui_translate/update_ui.py
+2
-0
2 additions, 0 deletions
ui_translate/update_ui.py
with
38 additions
and
5 deletions
ui_translate/__init__.py
+
1
−
1
View file @
bedce097
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
bl_info
=
{
bl_info
=
{
"
name
"
:
"
Manage UI translations
"
,
"
name
"
:
"
Manage UI translations
"
,
"
author
"
:
"
Bastien Montagne
"
,
"
author
"
:
"
Bastien Montagne
"
,
"
version
"
:
(
1
,
1
,
5
),
"
version
"
:
(
1
,
2
,
0
),
"
blender
"
:
(
2
,
80
,
0
),
"
blender
"
:
(
2
,
80
,
0
),
"
location
"
:
"
Main
\"
File
\"
menu, text editor, any UI control
"
,
"
location
"
:
"
Main
\"
File
\"
menu, text editor, any UI control
"
,
"
description
"
:
"
Allows managing UI translations directly from Blender
"
"
description
"
:
"
Allows managing UI translations directly from Blender
"
...
...
This diff is collapsed.
Click to expand it.
ui_translate/update_svn.py
+
35
−
4
View file @
bedce097
...
@@ -48,13 +48,11 @@ class UI_OT_i18n_updatetranslation_svn_branches(Operator):
...
@@ -48,13 +48,11 @@ class UI_OT_i18n_updatetranslation_svn_branches(Operator):
bl_idname
=
"
ui.i18n_updatetranslation_svn_branches
"
bl_idname
=
"
ui.i18n_updatetranslation_svn_branches
"
bl_label
=
"
Update I18n Branches
"
bl_label
=
"
Update I18n Branches
"
# Operator Arguments
use_skip_pot_gen
:
BoolProperty
(
use_skip_pot_gen
:
BoolProperty
(
name
=
"
Skip POT
"
,
name
=
"
Skip POT
"
,
description
=
"
Skip POT file generation
"
,
description
=
"
Skip POT file generation
"
,
default
=
False
,
default
=
False
,
)
)
# /End Operator Arguments
def
execute
(
self
,
context
):
def
execute
(
self
,
context
):
if
not
hasattr
(
self
,
"
settings
"
):
if
not
hasattr
(
self
,
"
settings
"
):
...
@@ -110,6 +108,40 @@ class UI_OT_i18n_updatetranslation_svn_branches(Operator):
...
@@ -110,6 +108,40 @@ class UI_OT_i18n_updatetranslation_svn_branches(Operator):
return
wm
.
invoke_props_dialog
(
self
)
return
wm
.
invoke_props_dialog
(
self
)
class
UI_OT_i18n_cleanuptranslation_svn_branches
(
Operator
):
"""
Clean up i18n svn
'
s branches (po files)
"""
bl_idname
=
"
ui.i18n_cleanuptranslation_svn_branches
"
bl_label
=
"
Clean up I18n Branches
"
def
execute
(
self
,
context
):
if
not
hasattr
(
self
,
"
settings
"
):
self
.
settings
=
settings
.
settings
i18n_sett
=
context
.
window_manager
.
i18n_update_svn_settings
# 'DEFAULT' and en_US are always valid, fully-translated "languages"!
stats
=
{
"
DEFAULT
"
:
1.0
,
"
en_US
"
:
1.0
}
context
.
window_manager
.
progress_begin
(
0
,
len
(
i18n_sett
.
langs
)
+
1
)
context
.
window_manager
.
progress_update
(
0
)
for
progress
,
lng
in
enumerate
(
i18n_sett
.
langs
):
context
.
window_manager
.
progress_update
(
progress
+
1
)
if
not
lng
.
use
:
print
(
"
Skipping {} language ({}).
"
.
format
(
lng
.
name
,
lng
.
uid
))
continue
print
(
"
Processing {} language ({}).
"
.
format
(
lng
.
name
,
lng
.
uid
))
po
=
utils_i18n
.
I18nMessages
(
uid
=
lng
.
uid
,
kind
=
'
PO
'
,
src
=
lng
.
po_path
,
settings
=
self
.
settings
)
print
(
"
Cleaned up {} commented messages.
"
.
format
(
po
.
clean_commented
()))
errs
=
po
.
check
(
fix
=
True
)
if
errs
:
print
(
"
Errors in this po, solved as best as possible!
"
)
print
(
"
\t
"
+
"
\n\t
"
.
join
(
errs
))
po
.
write
(
kind
=
"
PO
"
,
dest
=
lng
.
po_path
)
print
(
"
\n
"
)
context
.
window_manager
.
progress_end
()
return
{
'
FINISHED
'
}
class
UI_OT_i18n_updatetranslation_svn_trunk
(
Operator
):
class
UI_OT_i18n_updatetranslation_svn_trunk
(
Operator
):
"""
Update i18n svn
'
s branches (po files)
"""
"""
Update i18n svn
'
s branches (po files)
"""
bl_idname
=
"
ui.i18n_updatetranslation_svn_trunk
"
bl_idname
=
"
ui.i18n_updatetranslation_svn_trunk
"
...
@@ -176,7 +208,6 @@ class UI_OT_i18n_updatetranslation_svn_statistics(Operator):
...
@@ -176,7 +208,6 @@ class UI_OT_i18n_updatetranslation_svn_statistics(Operator):
bl_idname
=
"
ui.i18n_updatetranslation_svn_statistics
"
bl_idname
=
"
ui.i18n_updatetranslation_svn_statistics
"
bl_label
=
"
Update I18n Statistics
"
bl_label
=
"
Update I18n Statistics
"
# Operator Arguments
use_branches
:
BoolProperty
(
use_branches
:
BoolProperty
(
name
=
"
Check Branches
"
,
name
=
"
Check Branches
"
,
description
=
"
Check po files in branches
"
,
description
=
"
Check po files in branches
"
,
...
@@ -188,7 +219,6 @@ class UI_OT_i18n_updatetranslation_svn_statistics(Operator):
...
@@ -188,7 +219,6 @@ class UI_OT_i18n_updatetranslation_svn_statistics(Operator):
description
=
"
Check po files in trunk
"
,
description
=
"
Check po files in trunk
"
,
default
=
False
,
default
=
False
,
)
)
# /End Operator Arguments
report_name
=
"
i18n_info.txt
"
report_name
=
"
i18n_info.txt
"
...
@@ -242,6 +272,7 @@ class UI_OT_i18n_updatetranslation_svn_statistics(Operator):
...
@@ -242,6 +272,7 @@ class UI_OT_i18n_updatetranslation_svn_statistics(Operator):
classes
=
(
classes
=
(
UI_OT_i18n_updatetranslation_svn_branches
,
UI_OT_i18n_updatetranslation_svn_branches
,
UI_OT_i18n_cleanuptranslation_svn_branches
,
UI_OT_i18n_updatetranslation_svn_trunk
,
UI_OT_i18n_updatetranslation_svn_trunk
,
UI_OT_i18n_updatetranslation_svn_statistics
,
UI_OT_i18n_updatetranslation_svn_statistics
,
)
)
This diff is collapsed.
Click to expand it.
ui_translate/update_ui.py
+
2
−
0
View file @
bedce097
...
@@ -178,6 +178,8 @@ class UI_PT_i18n_update_translations_settings(Panel):
...
@@ -178,6 +178,8 @@ class UI_PT_i18n_update_translations_settings(Panel):
col
.
separator
()
col
.
separator
()
col
.
operator
(
"
ui.i18n_updatetranslation_svn_branches
"
,
text
=
"
Update Branches
"
)
col
.
operator
(
"
ui.i18n_updatetranslation_svn_branches
"
,
text
=
"
Update Branches
"
)
col
.
operator
(
"
ui.i18n_updatetranslation_svn_trunk
"
,
text
=
"
Update Trunk
"
)
col
.
operator
(
"
ui.i18n_updatetranslation_svn_trunk
"
,
text
=
"
Update Trunk
"
)
col
.
separator
()
col
.
operator
(
"
ui.i18n_cleanuptranslation_svn_branches
"
,
text
=
"
Clean up Branches
"
)
col
.
operator
(
"
ui.i18n_updatetranslation_svn_statistics
"
,
text
=
"
Statistics
"
)
col
.
operator
(
"
ui.i18n_updatetranslation_svn_statistics
"
,
text
=
"
Statistics
"
)
if
i18n_sett
.
active_lang
>=
0
and
i18n_sett
.
active_lang
<
len
(
i18n_sett
.
langs
):
if
i18n_sett
.
active_lang
>=
0
and
i18n_sett
.
active_lang
<
len
(
i18n_sett
.
langs
):
...
...
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