From ec67334e25b92c60f97978ef1bf754b4ba55127e Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sat, 27 Oct 2012 11:12:09 +0000 Subject: A few more BMesh errors messages translated, and "automated" translation for modifers too! --- release/scripts/modules/bl_i18n_utils/settings.py | 56 ++++++++++------------- source/blender/blenkernel/intern/DerivedMesh.c | 8 ++-- source/blender/blenkernel/intern/cloth.c | 10 ++-- source/blender/blenkernel/intern/modifier.c | 7 ++- source/blender/bmesh/intern/bmesh_core.c | 11 +++-- source/blender/bmesh/intern/bmesh_walkers_impl.c | 3 +- source/blender/editors/armature/meshlaplacian.c | 2 +- source/blender/modifiers/intern/MOD_boolean.c | 2 +- source/blender/modifiers/intern/MOD_decimate.c | 2 +- source/blender/modifiers/intern/MOD_meshdeform.c | 8 ++-- 10 files changed, 49 insertions(+), 60 deletions(-) diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index 7de6ff80fe4..4bfcee9c583 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -154,12 +154,18 @@ _msg_re = r"(?P" + _str_whole_re.format(_="_msg") + r")" PYGETTEXT_KEYWORDS = (() + tuple((r"{}\(\s*" + _msg_re + r"\s*\)").format(it) for it in ("IFACE_", "TIP_", "N_")) + + tuple((r"{}\(\s*" + _ctxt_re + r"\s*,\s*" + _msg_re + r"\s*\)").format(it) for it in ("CTX_IFACE_", "CTX_TIP_", "CTX_N_")) + + tuple(("{}\\((?:[^\"',]+,){{1,2}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it) for it in ("BKE_report", "BKE_reportf", "BKE_reports_prepend", "BKE_reports_prependf")) + - tuple(("{}\\((?:[^\"',]+,){{3}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it) - for it in ("BMO_error_raise",)) + + tuple(("{}\\((?:[^\"',]+,){{3}}\\s*" + _msg_re + r"\s*,").format(it) + for it in ("BMO_error_raise",)) + + + tuple(("{}\\((?:[^\"',]+,)\\s*" + _msg_re + r"\s*(?:\)|,)").format(it) + for it in ("modifier_setError",)) ) ESCAPE_RE = ( @@ -225,47 +231,35 @@ TOOLS_DIR = os.path.join(os.path.dirname(__file__)) PYTHON3_EXEC = "python3" # The Blender executable! -# This is just an example, you’ll most likely have to edit it in your -# user_settings.py! -BLENDER_EXEC = os.path.abspath(os.path.join(TOOLS_DIR, "..", "..", "..", "..", - "blender")) +# This is just an example, you’ll most likely have to edit it in your user_settings.py! +BLENDER_EXEC = os.path.abspath(os.path.join(TOOLS_DIR, "..", "..", "..", "..", "blender")) -# The xgettext tool. You’ll likely have to edit it in your user_settings.py -# if you’re under Windows. +# The xgettext tool. You’ll likely have to edit it in your user_settings.py if you’re under Windows. GETTEXT_XGETTEXT_EXECUTABLE = "xgettext" -# The gettext msgmerge tool. You’ll likely have to edit it in your -# user_settings.py if you’re under Windows. +# The gettext msgmerge tool. You’ll likely have to edit it in your user_settings.py if you’re under Windows. GETTEXT_MSGMERGE_EXECUTABLE = "msgmerge" -# The gettext msgfmt "compiler". You’ll likely have to edit it in your -# user_settings.py if you’re under Windows. +# The gettext msgfmt "compiler". You’ll likely have to edit it in your user_settings.py if you’re under Windows. GETTEXT_MSGFMT_EXECUTABLE = "msgfmt" -# The svn binary... You’ll likely have to edit it in your -# user_settings.py if you’re under Windows. +# The svn binary... You’ll likely have to edit it in your user_settings.py if you’re under Windows. SVN_EXECUTABLE = "svn" # The FriBidi C compiled library (.so under Linux, .dll under windows...). -# You’ll likely have to edit it in your user_settings.py if you’re under -# Windows., e.g. using the included one: +# You’ll likely have to edit it in your user_settings.py if you’re under Windows., e.g. using the included one: # FRIBIDI_LIB = os.path.join(TOOLS_DIR, "libfribidi.dll") FRIBIDI_LIB = "libfribidi.so.0" -# The name of the (currently empty) file that must be present in a po's -# directory to enable rtl-preprocess. +# The name of the (currently empty) file that must be present in a po's directory to enable rtl-preprocess. RTL_PREPROCESS_FILE = "is_rtl" # The Blender source root path. -# This is just an example, you’ll most likely have to override it in your -# user_settings.py! -SOURCE_DIR = os.path.abspath(os.path.join(TOOLS_DIR, "..", "..", "..", "..", - "..", "..", "blender_msgs")) +# This is just an example, you’ll most likely have to override it in your user_settings.py! +SOURCE_DIR = os.path.abspath(os.path.join(TOOLS_DIR, "..", "..", "..", "..", "..", "..", "blender_msgs")) -# The bf-translation repository (you'll likely have to override this in your -# user_settings.py). -I18N_DIR = os.path.abspath(os.path.join(TOOLS_DIR, "..", "..", "..", "..", - "..", "..", "i18n")) +# The bf-translation repository (you'll likely have to override this in your user_settings.py). +I18N_DIR = os.path.abspath(os.path.join(TOOLS_DIR, "..", "..", "..", "..", "..", "..", "i18n")) # The /branches path (overriden in bf-translation's i18n_override_settings.py). BRANCHES_DIR = os.path.join(I18N_DIR, "branches") @@ -285,12 +279,10 @@ FILE_NAME_MESSAGES = os.path.join(TRUNK_PO_DIR, "messages.txt") # The Blender source path to check for i18n macros. POTFILES_SOURCE_DIR = os.path.join(SOURCE_DIR, "source") -# The "source" file storing which files should be processed by xgettext, -# used to create FILE_NAME_POTFILES +# The "source" file storing which files should be processed by xgettext, used to create FILE_NAME_POTFILES FILE_NAME_SRC_POTFILES = os.path.join(TRUNK_PO_DIR, "_POTFILES.in") -# The final (generated) file storing which files -# should be processed by xgettext. +# The final (generated) file storing which files should be processed by xgettext. FILE_NAME_POTFILES = os.path.join(TRUNK_PO_DIR, "POTFILES.in") # The template messages file. @@ -298,9 +290,7 @@ FILE_NAME_POT = os.path.join(TRUNK_PO_DIR, ".".join((DOMAIN, "pot"))) # Other py files that should be searched for ui strings, relative to SOURCE_DIR. # Needed for Cycles, currently... -CUSTOM_PY_UI_FILES = [os.path.join("intern", "cycles", "blender", - "addon", "ui.py"), - ] +CUSTOM_PY_UI_FILES = [os.path.join("intern", "cycles", "blender", "addon", "ui.py"),] # A cache storing validated msgids, to avoid re-spellchecking them. diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index b13e8b4db06..ddbd4588778 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -51,8 +51,6 @@ #include "BLI_utildefines.h" #include "BLI_linklist.h" -#include "BLF_translation.h" - #include "BKE_cdderivedmesh.h" #include "BKE_displist.h" #include "BKE_key.h" @@ -1507,7 +1505,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos if (!modifier_isEnabled(scene, md, required_mode)) continue; if (mti->type == eModifierTypeType_OnlyDeform && !useDeform) continue; if ((mti->flags & eModifierTypeFlag_RequiresOriginalData) && dm) { - modifier_setError(md, "%s", TIP_("Modifier requires original data, bad stack position.")); + modifier_setError(md, "Modifier requires original data, bad stack position"); continue; } if (sculpt_mode && (!has_multires || multires_applied)) { @@ -1520,7 +1518,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos unsupported |= multires_applied; if (unsupported) { - modifier_setError(md, "%s", TIP_("Not supported in sculpt mode.")); + modifier_setError(md, "Not supported in sculpt mode"); continue; } } @@ -1881,7 +1879,7 @@ int editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh *d if (!modifier_isEnabled(scene, md, required_mode)) return 0; if ((mti->flags & eModifierTypeFlag_RequiresOriginalData) && dm) { - modifier_setError(md, "%s", TIP_("Modifier requires original data, bad stack position.")); + modifier_setError(md, "Modifier requires original data, bad stack position"); return 0; } diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 88dfb4577d5..f1d73c7777a 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -41,8 +41,6 @@ #include "BLI_utildefines.h" #include "BLI_linklist.h" -#include "BLF_translation.h" - #include "BKE_cdderivedmesh.h" #include "BKE_cloth.h" #include "BKE_effect.h" @@ -845,7 +843,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d clmd->clothObject->edgehash = NULL; } else if (!clmd->clothObject) { - modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject.")); + modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject"); return 0; } @@ -907,7 +905,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d if ( !cloth_build_springs ( clmd, dm ) ) { cloth_free_modifier ( clmd ); - modifier_setError(&(clmd->modifier), "%s", TIP_("Can't build springs.")); + modifier_setError(&(clmd->modifier), "Cannot build springs"); printf("cloth_free_modifier cloth_build_springs\n"); return 0; } @@ -949,7 +947,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm ) clmd->clothObject->verts = MEM_callocN ( sizeof ( ClothVertex ) * clmd->clothObject->numverts, "clothVertex" ); if ( clmd->clothObject->verts == NULL ) { cloth_free_modifier ( clmd ); - modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject->verts.")); + modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject->verts"); printf("cloth_free_modifier clmd->clothObject->verts\n"); return; } @@ -959,7 +957,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm ) clmd->clothObject->mfaces = MEM_callocN ( sizeof ( MFace ) * clmd->clothObject->numfaces, "clothMFaces" ); if ( clmd->clothObject->mfaces == NULL ) { cloth_free_modifier ( clmd ); - modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject->mfaces.")); + modifier_setError(&(clmd->modifier), "Out of memory on allocating clmd->clothObject->mfaces"); printf("cloth_free_modifier clmd->clothObject->mfaces\n"); return; } diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 0afd048e7f2..9c7cbc42bdd 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -55,6 +55,8 @@ #include "BLI_linklist.h" #include "BLI_string.h" +#include "BLF_translation.h" + #include "BKE_cloth.h" #include "BKE_key.h" #include "BKE_multires.h" @@ -259,12 +261,13 @@ int modifier_nonGeometrical(ModifierData *md) return (mti->type == eModifierTypeType_NonGeometrical); } -void modifier_setError(ModifierData *md, const char *format, ...) +void modifier_setError(ModifierData *md, const char *_format, ...) { char buffer[512]; va_list ap; + const char *format = TIP_(_format); - va_start(ap, format); + va_start(ap, _format); vsnprintf(buffer, sizeof(buffer), format, ap); va_end(ap); buffer[sizeof(buffer) - 1] = '\0'; diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 4e6decfa913..0910dd82701 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -28,12 +28,13 @@ #include "MEM_guardedalloc.h" #include "BLI_math_vector.h" - -#include "BKE_DerivedMesh.h" - #include "BLI_listbase.h" #include "BLI_array.h" +#include "BLF_translation.h" + +#include "BKE_DerivedMesh.h" + #include "bmesh.h" #include "intern/bmesh_private.h" @@ -960,7 +961,7 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const short do_del int rlen = count_flagged_radial(bm, l_iter, _FLAG_JF); if (rlen > 2) { - err = "Input faces do not form a contiguous manifold region"; + err = N_("Input faces do not form a contiguous manifold region"); goto error; } else if (rlen == 1) { @@ -1023,7 +1024,7 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const short do_del newf = BM_face_create_ngon(bm, v1, v2, edges, tote, FALSE); if (UNLIKELY(!newf || BMO_error_occurred(bm))) { if (!BMO_error_occurred(bm)) - err = "Invalid boundary region to join faces"; + err = N_("Invalid boundary region to join faces"); goto error; } diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c index 225ea6c2ef6..bb1e599f097 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_impl.c +++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c @@ -303,8 +303,7 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker) if (!BM_vert_is_manifold(v)) { BMW_reset(walker); BMO_error_raise(walker->bm, NULL, BMERR_WALKER_FAILED, - "Non-manifold vert " - "while searching region boundary"); + "Non-manifold vert while searching region boundary"); return NULL; } diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c index 3963f9fed2d..e7586311312 100644 --- a/source/blender/editors/armature/meshlaplacian.c +++ b/source/blender/editors/armature/meshlaplacian.c @@ -1721,7 +1721,7 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind } } else { - modifier_setError(&mmd->modifier, "%s", TIP_("Failed to find bind solution (increase precision?).")); + modifier_setError(&mmd->modifier, "Failed to find bind solution (increase precision?)"); error("Mesh Deform: failed to find bind solution."); break; } diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 39bbe034bb8..0a48003fc81 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -167,7 +167,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (result) return result; else - modifier_setError(md, "%s", TIP_("Can't execute boolean operation.")); + modifier_setError(md, "Cannot execute boolean operation"); } return derivedData; diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index a8033876037..dc29e59d549 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -126,7 +126,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } if (dmd->face_count <= 3) { - modifier_setError(md, "%s", TIP_("Modifier requires more than 3 input faces")); + modifier_setError(md, "Modifier requires more than 3 input faces"); return dm; } diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index e584244e6a7..f4d9b7270e6 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -218,7 +218,7 @@ static void meshdeformModifier_do( } if (!cagedm) { - modifier_setError(md, "%s", TIP_("Can't get mesh from cage object.")); + modifier_setError(md, "Cannot get mesh from cage object"); return; } @@ -246,17 +246,17 @@ static void meshdeformModifier_do( totcagevert = cagedm->getNumVerts(cagedm); if (mmd->totvert != totvert) { - modifier_setError(md, TIP_("Verts changed from %d to %d."), mmd->totvert, totvert); + modifier_setError(md, "Verts changed from %d to %d", mmd->totvert, totvert); cagedm->release(cagedm); return; } else if (mmd->totcagevert != totcagevert) { - modifier_setError(md, TIP_("Cage verts changed from %d to %d."), mmd->totcagevert, totcagevert); + modifier_setError(md, "Cage verts changed from %d to %d", mmd->totcagevert, totcagevert); cagedm->release(cagedm); return; } else if (mmd->bindcagecos == NULL) { - modifier_setError(md, "%s", TIP_("Bind data missing.")); + modifier_setError(md, "Bind data missing"); cagedm->release(cagedm); return; } -- cgit v1.2.3