[Bf-codereview] Garlic patch (r40364), cant be applied, just for review (issue 5073041)

ideasman42 at gmail.com ideasman42 at gmail.com
Tue Sep 20 05:35:04 CEST 2011


Reviewers: nazgul, bf-codereview_blender.org,

Message:
Checked the entire patch and have some general comments,
BUT - I could'nt get garlic working, on selecting a language - it would
just print for eg:
   Could not change locale to zh_CN nor zh_CN.UTF-8
tried building with both cmake/scons, same issue.


So without testing heres feedback from reading over the patch.

- Some verbose checks should be made into macros, there are macros
defined locally in C files, but should be generic ones in headers IMHO.

- re: python translations, it would be nice to have something less
intrusive.... for example, any value given to text="...." could be
assumed to be translated unless a property in the layout is set

layout.use_trasnlation = False
layout.operator("...", text="This text isnt translated!")
layout.use_trasnlation = True

or... an argument.

layout.operator("...", text="This text isnt translated!",
translate=False)

This way we wouldn't need every custom text to call _() and our scripts
can remain unchanged.

Function calls in python are much more expensive then in C, measured the
overall slowdown and its only a few % overall - but depends totally on
how many buttons are visible ofcourse.

since the rna functions are accessing high level I think its ok if they
translate by default too, but dont have a strong opinion on this, just a
slight preference for speed & less kludgy code.

On the other hand using gettext standard method in py gives some
consistancy and means translation is explicit.


Other comments inline...



http://codereview.appspot.com/5073041/diff/1/source/blender/blenfont/BLF_api.h
File source/blender/blenfont/BLF_api.h (right):

http://codereview.appspot.com/5073041/diff/1/source/blender/blenfont/BLF_api.h#newcode45
source/blender/blenfont/BLF_api.h:45: const char* BLF_gettext(const char
*msgid);
Realize BLF was supposed to handle translations from the start but IMHO
it would fit better if we have gettext split out from BLF_api.h, so text
rendering & text translations are not mixed.

What about BLF_lang.h / BLF_api_lang.h? - then we can have translation
macros and functions there.

http://codereview.appspot.com/5073041/diff/1/source/blender/editors/space_view3d/view3d_header.c
File source/blender/editors/space_view3d/view3d_header.c (right):

http://codereview.appspot.com/5073041/diff/1/source/blender/editors/space_view3d/view3d_header.c#newcode473
source/blender/editors/space_view3d/view3d_header.c:473: #define
TIP_(msgid) (((U.transopts&USER_DOTRANSLATE) &&
(U.transopts&USER_TR_TOOLTIPS))?BLF_gettext(msgid):(msgid))
noticed a few defines like this, could we have some generic macros for
translation besides _N and _?

http://codereview.appspot.com/5073041/diff/1/source/blender/editors/transform/transform_orientations.c
File source/blender/editors/transform/transform_orientations.c (right):

http://codereview.appspot.com/5073041/diff/1/source/blender/editors/transform/transform_orientations.c#newcode419
source/blender/editors/transform/transform_orientations.c:419:
if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) {
Re: (U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)

Noticed this in a few places IMHO these should be made into a macro.

http://codereview.appspot.com/5073041/diff/1/source/blender/python/generic/blf_py_api.c
File source/blender/python/generic/blf_py_api.c (right):

http://codereview.appspot.com/5073041/diff/1/source/blender/python/generic/blf_py_api.c#newcode373
source/blender/python/generic/blf_py_api.c:373: #ifdef INTERNATIONAL
committed change r40377. so this passes through the value if no
translation is done, will speed up drawing when no translation happens.



Please review this at http://codereview.appspot.com/5073041/

Affected files:
   M     SConstruct
   M     release/bin/.blender/.Blanguages
   M     release/scripts/startup/bl_operators/wm.py
   M     release/scripts/startup/bl_ui/properties_animviz.py
   M     release/scripts/startup/bl_ui/properties_data_armature.py
   M     release/scripts/startup/bl_ui/properties_data_bone.py
   M     release/scripts/startup/bl_ui/properties_data_camera.py
   M     release/scripts/startup/bl_ui/properties_data_curve.py
   M     release/scripts/startup/bl_ui/properties_data_empty.py
   M     release/scripts/startup/bl_ui/properties_data_lamp.py
   M     release/scripts/startup/bl_ui/properties_data_mesh.py
   M     release/scripts/startup/bl_ui/properties_data_metaball.py
   M     release/scripts/startup/bl_ui/properties_data_modifier.py
   M     release/scripts/startup/bl_ui/properties_game.py
   M     release/scripts/startup/bl_ui/properties_material.py
   M     release/scripts/startup/bl_ui/properties_object.py
   M     release/scripts/startup/bl_ui/properties_object_constraint.py
   M     release/scripts/startup/bl_ui/properties_particle.py
   M     release/scripts/startup/bl_ui/properties_physics_cloth.py
   M     release/scripts/startup/bl_ui/properties_physics_common.py
   M     release/scripts/startup/bl_ui/properties_physics_field.py
   M     release/scripts/startup/bl_ui/properties_physics_fluid.py
   M     release/scripts/startup/bl_ui/properties_physics_smoke.py
   M     release/scripts/startup/bl_ui/properties_physics_softbody.py
   M     release/scripts/startup/bl_ui/properties_render.py
   M     release/scripts/startup/bl_ui/properties_scene.py
   M     release/scripts/startup/bl_ui/properties_texture.py
   M     release/scripts/startup/bl_ui/properties_world.py
   M     release/scripts/startup/bl_ui/space_console.py
   M     release/scripts/startup/bl_ui/space_dopesheet.py
   M     release/scripts/startup/bl_ui/space_graph.py
   M     release/scripts/startup/bl_ui/space_image.py
   M     release/scripts/startup/bl_ui/space_info.py
   M     release/scripts/startup/bl_ui/space_logic.py
   M     release/scripts/startup/bl_ui/space_nla.py
   M     release/scripts/startup/bl_ui/space_node.py
   M     release/scripts/startup/bl_ui/space_sequencer.py
   M     release/scripts/startup/bl_ui/space_text.py
   M     release/scripts/startup/bl_ui/space_time.py
   M     release/scripts/startup/bl_ui/space_userpref.py
   M     release/scripts/startup/bl_ui/space_userpref_keymap.py
   M     release/scripts/startup/bl_ui/space_view3d.py
   M     release/scripts/startup/bl_ui/space_view3d_toolbar.py
   M     source/blender/blenfont/BLF_api.h
   M     source/blender/blenfont/intern/blf.c
   M     source/blender/blenfont/intern/blf_lang.c
   M     source/blender/blenkernel/BKE_font.h
   M     source/blender/blenkernel/CMakeLists.txt
   M     source/blender/blenkernel/SConscript
   M     source/blender/blenkernel/intern/font.c
   M     source/blender/blenlib/BLI_fileops.h
   M     source/blender/blenlib/intern/fileops.c
   M     source/blender/editors/armature/CMakeLists.txt
   M     source/blender/editors/armature/SConscript
   M     source/blender/editors/armature/poselib.c
   M     source/blender/editors/include/UI_interface.h
   M     source/blender/editors/interface/interface.c
   M     source/blender/editors/interface/interface_handlers.c
   M     source/blender/editors/interface/interface_intern.h
   M     source/blender/editors/interface/interface_layout.c
   M     source/blender/editors/interface/interface_panel.c
   M     source/blender/editors/interface/interface_regions.c
   M     source/blender/editors/interface/interface_style.c
   M     source/blender/editors/interface/interface_templates.c
   M     source/blender/editors/interface/interface_utils.c
   M     source/blender/editors/interface/interface_widgets.c
   M     source/blender/editors/interface/view2d.c
   M     source/blender/editors/interface/view2d_ops.c
   M     source/blender/editors/screen/area.c
   M     source/blender/editors/space_buttons/CMakeLists.txt
   M     source/blender/editors/space_buttons/SConscript
   M     source/blender/editors/space_buttons/buttons_header.c
   M     source/blender/editors/space_file/file_draw.c
   M     source/blender/editors/space_file/file_panels.c
   M     source/blender/editors/space_file/filesel.c
   M     source/blender/editors/space_graph/CMakeLists.txt
   M     source/blender/editors/space_graph/SConscript
   M     source/blender/editors/space_graph/graph_buttons.c
   M     source/blender/editors/space_info/space_info.c
   M     source/blender/editors/space_logic/CMakeLists.txt
   M     source/blender/editors/space_logic/logic_window.c
   M     source/blender/editors/space_nla/CMakeLists.txt
   M     source/blender/editors/space_nla/SConscript
   M     source/blender/editors/space_nla/nla_buttons.c
   M     source/blender/editors/space_node/node_draw.c
   M     source/blender/editors/space_node/node_header.c
   M     source/blender/editors/space_view3d/view3d_header.c
   M     source/blender/editors/space_view3d/view3d_toolbar.c
   M     source/blender/editors/transform/CMakeLists.txt
   M     source/blender/editors/transform/SConscript
   M     source/blender/editors/transform/transform_orientations.c
   M     source/blender/makesdna/DNA_userdef_types.h
   M     source/blender/makesrna/RNA_access.h
   M     source/blender/makesrna/SConscript
   M     source/blender/makesrna/intern/CMakeLists.txt
   M     source/blender/makesrna/intern/SConscript
   M     source/blender/makesrna/intern/rna_access.c
   M     source/blender/makesrna/intern/rna_userdef.c
   M     source/blender/python/SConscript
   M     source/blender/python/generic/CMakeLists.txt
   M     source/blender/python/generic/blf_py_api.c
   M     source/blender/windowmanager/intern/wm_files.c
   M     source/blender/windowmanager/intern/wm_init_exit.c
   M     source/blender/windowmanager/intern/wm_operators.c
   M     source/blender/windowmanager/intern/wm_window.c
   M     source/creator/CMakeLists.txt
   M     source/gameengine/GamePlayer/ghost/GPG_ghost.cpp




More information about the Bf-codereview mailing list