Fix lots of missing messages i18n handling in `uiItemL` calls.

Also fix several wrong usages of `IFACE_` (as a reminder, error/info
messages should use `TIP_`, not `IFACE_`).
This commit is contained in:
Bastien Montagne 2021-11-02 17:50:18 +01:00
parent 20b163b533
commit 29dff8f844
24 changed files with 67 additions and 57 deletions

View File

@ -403,10 +403,10 @@ static void generator_panel_draw(const bContext *C, Panel *panel)
char xval[32];
/* The first value gets a "Coefficient" label. */
BLI_strncpy(xval, "Coefficient", sizeof(xval));
BLI_strncpy(xval, N_("Coefficient"), sizeof(xval));
for (int i = 0; i < data->arraysize; i++) {
uiItemFullR(col, ptr, prop, i, 0, 0, N_(xval), ICON_NONE);
uiItemFullR(col, ptr, prop, i, 0, 0, IFACE_(xval), ICON_NONE);
BLI_snprintf(xval, sizeof(xval), "x^%d", i + 1);
}
break;
@ -420,17 +420,17 @@ static void generator_panel_draw(const bContext *C, Panel *panel)
uiLayoutColumn(split, false);
uiLayout *title_col = uiLayoutColumn(split, false);
uiLayout *title_row = uiLayoutRow(title_col, true);
uiItemL(title_row, N_("A"), ICON_NONE);
uiItemL(title_row, N_("B"), ICON_NONE);
uiItemL(title_row, IFACE_("A"), ICON_NONE);
uiItemL(title_row, IFACE_("B"), ICON_NONE);
}
uiLayout *first_row = uiLayoutRow(col, true);
uiItemFullR(first_row, ptr, prop, 0, 0, 0, N_("y = (Ax + B)"), ICON_NONE);
uiItemFullR(first_row, ptr, prop, 0, 0, 0, IFACE_("y = (Ax + B)"), ICON_NONE);
uiItemFullR(first_row, ptr, prop, 1, 0, 0, "", ICON_NONE);
for (int i = 2; i < data->arraysize - 1; i++) {
/* \u2715 is the multiplication symbol. */
uiLayout *row = uiLayoutRow(col, true);
uiItemFullR(row, ptr, prop, i, 0, 0, N_("\u2715 (Ax + B)"), ICON_NONE);
uiItemFullR(row, ptr, prop, i, 0, 0, IFACE_("\u2715 (Ax + B)"), ICON_NONE);
uiItemFullR(row, ptr, prop, i + 1, 0, 0, "", ICON_NONE);
}
break;

View File

@ -4450,7 +4450,7 @@ static void ui_def_but_rna__panel_type(bContext *C, uiLayout *layout, void *but_
}
else {
char msg[256];
SNPRINTF(msg, "Missing Panel: %s", panel_type);
SNPRINTF(msg, TIP_("Missing Panel: %s"), panel_type);
uiItemL(layout, msg, ICON_NONE);
}
}
@ -4479,7 +4479,7 @@ static void ui_def_but_rna__menu_type(bContext *C, uiLayout *layout, void *but_p
}
else {
char msg[256];
SNPRINTF(msg, "Missing Menu: %s", menu_type);
SNPRINTF(msg, TIP_("Missing Menu: %s"), menu_type);
uiItemL(layout, msg, ICON_NONE);
}
}

View File

@ -1339,7 +1339,7 @@ static void ui_item_menu_hold(struct bContext *C, ARegion *butregion, uiBut *but
UI_menutype_draw(C, mt, layout);
}
else {
uiItemL(layout, "Menu Missing:", ICON_NONE);
uiItemL(layout, TIP_("Menu Missing:"), ICON_NONE);
uiItemL(layout, menu_id, ICON_NONE);
}
UI_popup_menu_end(C, pup);

View File

@ -2743,7 +2743,7 @@ static void draw_constraint_header(uiLayout *layout, Object *ob, bConstraint *co
uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
}
else {
uiItemL(row, con->name, ICON_NONE);
uiItemL(row, IFACE_(con->name), ICON_NONE);
}
/* proxy-protected constraints cannot be edited, so hide up/down + close buttons */
@ -6142,8 +6142,8 @@ void uiTemplateInputStatus(uiLayout *layout, struct bContext *C)
uiLayout *row = uiLayoutRow(col, true);
uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
const char *msg = WM_window_cursor_keymap_status_get(win, i, 0);
const char *msg_drag = WM_window_cursor_keymap_status_get(win, i, 1);
const char *msg = TIP_(WM_window_cursor_keymap_status_get(win, i, 0));
const char *msg_drag = TIP_(WM_window_cursor_keymap_status_get(win, i, 1));
if (msg || (msg_drag == NULL)) {
uiItemL(row, msg ? msg : "", (ICON_MOUSE_LMB + i));
@ -6498,12 +6498,15 @@ void uiTemplateCacheFile(uiLayout *layout,
row = uiLayoutRow(layout, false);
/* For Cycles, verify that experimental features are enabled. */
if (BKE_scene_uses_cycles(scene) && !BKE_scene_uses_cycles_experimental_features(scene)) {
uiItemL(row,
"The Cycles Alembic Procedural is only available with the experimental feature set",
ICON_INFO);
uiItemL(
row,
TIP_(
"The Cycles Alembic Procedural is only available with the experimental feature set"),
ICON_INFO);
}
else {
uiItemL(row, "The active render engine does not have an Alembic Procedural", ICON_INFO);
uiItemL(
row, TIP_("The active render engine does not have an Alembic Procedural"), ICON_INFO);
}
}

View File

@ -660,7 +660,7 @@ void BasicTreeViewItem::add_label(uiLayout &layout, StringRefNull label_override
if (icon == ICON_NONE && !is_collapsible()) {
uiItemS_ex(&layout, 0.8f);
}
uiItemL(&layout, label.c_str(), icon);
uiItemL(&layout, IFACE_(label.c_str()), icon);
}
void BasicTreeViewItem::on_activate()

View File

@ -234,7 +234,7 @@ static void screen_user_menu_draw(const bContext *C, Menu *menu)
}
else {
if (show_missing) {
SNPRINTF(label, "Missing: %s", umi_op->op_idname);
SNPRINTF(label, TIP_("Missing: %s"), umi_op->op_idname);
uiItemL(menu->layout, label, ICON_NONE);
}
}
@ -248,7 +248,7 @@ static void screen_user_menu_draw(const bContext *C, Menu *menu)
}
else {
if (show_missing) {
SNPRINTF(label, "Missing: %s", umi_mt->mt_idname);
SNPRINTF(label, TIP_("Missing: %s"), umi_mt->mt_idname);
uiItemL(menu->layout, label, ICON_NONE);
}
}
@ -290,7 +290,7 @@ static void screen_user_menu_draw(const bContext *C, Menu *menu)
}
if (!ok) {
if (show_missing) {
SNPRINTF(label, "Missing: %s.%s", umi_pr->context_data_path, umi_pr->prop_id);
SNPRINTF(label, TIP_("Missing: %s.%s"), umi_pr->context_data_path, umi_pr->prop_id);
uiItemL(menu->layout, label, ICON_NONE);
}
}

View File

@ -593,17 +593,17 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel)
else {
if ((fcu->bezt == NULL) && (fcu->modifiers.first)) {
/* modifiers only - so no keyframes to be active */
uiItemL(layout, IFACE_("F-Curve only has F-Modifiers"), ICON_NONE);
uiItemL(layout, IFACE_("See Modifiers panel below"), ICON_INFO);
uiItemL(layout, TIP_("F-Curve only has F-Modifiers"), ICON_NONE);
uiItemL(layout, TIP_("See Modifiers panel below"), ICON_INFO);
}
else if (fcu->fpt) {
/* samples only */
uiItemL(layout,
IFACE_("F-Curve doesn't have any keyframes as it only contains sampled points"),
TIP_("F-Curve doesn't have any keyframes as it only contains sampled points"),
ICON_NONE);
}
else {
uiItemL(layout, IFACE_("No active keyframe on F-Curve"), ICON_NONE);
uiItemL(layout, TIP_("No active keyframe on F-Curve"), ICON_NONE);
}
}
@ -688,28 +688,30 @@ static void driver_dvar_invalid_name_query_cb(bContext *C, void *dvar_v, void *U
DriverVar *dvar = (DriverVar *)dvar_v;
if (dvar->flag & DVAR_FLAG_INVALID_EMPTY) {
uiItemL(layout, "It cannot be left blank", ICON_ERROR);
uiItemL(layout, TIP_("It cannot be left blank"), ICON_ERROR);
}
if (dvar->flag & DVAR_FLAG_INVALID_START_NUM) {
uiItemL(layout, "It cannot start with a number", ICON_ERROR);
uiItemL(layout, TIP_("It cannot start with a number"), ICON_ERROR);
}
if (dvar->flag & DVAR_FLAG_INVALID_START_CHAR) {
uiItemL(layout,
"It cannot start with a special character,"
" including '$', '@', '!', '~', '+', '-', '_', '.', or ' '",
TIP_("It cannot start with a special character,"
" including '$', '@', '!', '~', '+', '-', '_', '.', or ' '"),
ICON_NONE);
}
if (dvar->flag & DVAR_FLAG_INVALID_HAS_SPACE) {
uiItemL(layout, "It cannot contain spaces (e.g. 'a space')", ICON_ERROR);
uiItemL(layout, TIP_("It cannot contain spaces (e.g. 'a space')"), ICON_ERROR);
}
if (dvar->flag & DVAR_FLAG_INVALID_HAS_DOT) {
uiItemL(layout, "It cannot contain dots (e.g. 'a.dot')", ICON_ERROR);
uiItemL(layout, TIP_("It cannot contain dots (e.g. 'a.dot')"), ICON_ERROR);
}
if (dvar->flag & DVAR_FLAG_INVALID_HAS_SPECIAL) {
uiItemL(layout, "It cannot contain special (non-alphabetical/numeric) characters", ICON_ERROR);
uiItemL(layout,
TIP_("It cannot contain special (non-alphabetical/numeric) characters"),
ICON_ERROR);
}
if (dvar->flag & DVAR_FLAG_INVALID_PY_KEYWORD) {
uiItemL(layout, "It cannot be a reserved keyword in Python", ICON_INFO);
uiItemL(layout, TIP_("It cannot be a reserved keyword in Python"), ICON_INFO);
}
UI_popup_menu_end(C, pup);

View File

@ -1056,7 +1056,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, bool color_ma
if (imf->imtype == R_IMF_IMTYPE_CINEON) {
#if 1
uiItemL(col, IFACE_("Hard coded Non-Linear, Gamma:1.7"), ICON_NONE);
uiItemL(col, TIP_("Hard coded Non-Linear, Gamma:1.7"), ICON_NONE);
#else
uiItemR(col, imfptr, "use_cineon_log", 0, NULL, ICON_NONE);
uiItemR(col, imfptr, "cineon_black", 0, NULL, ICON_NONE);

View File

@ -993,7 +993,7 @@ static void node_shader_buts_vertex_color(uiLayout *layout, bContext *C, Pointer
}
}
else {
uiItemL(layout, "No mesh in active object.", ICON_ERROR);
uiItemL(layout, TIP_("No mesh in active object"), ICON_ERROR);
}
}

View File

@ -388,7 +388,7 @@ static void options_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetEnabled(layout, !is_baked);
if (use_cache && !is_first) {
uiItemL(layout, "Cached from the first line art modifier.", ICON_INFO);
uiItemL(layout, TIP_("Cached from the first line art modifier"), ICON_INFO);
return;
}
@ -439,7 +439,7 @@ static void occlusion_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetEnabled(layout, !is_baked);
if (!show_in_front) {
uiItemL(layout, IFACE_("Object is not in front"), ICON_INFO);
uiItemL(layout, TIP_("Object is not in front"), ICON_INFO);
}
layout = uiLayoutColumn(layout, false);
@ -568,7 +568,7 @@ static void face_mark_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetEnabled(layout, !is_baked);
if (use_cache && !is_first) {
uiItemL(layout, "Cached from the first line art modifier.", ICON_INFO);
uiItemL(layout, TIP_("Cached from the first line art modifier"), ICON_INFO);
return;
}
@ -596,7 +596,7 @@ static void chaining_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetEnabled(layout, !is_baked);
if (use_cache && !is_first) {
uiItemL(layout, "Cached from the first line art modifier.", ICON_INFO);
uiItemL(layout, TIP_("Cached from the first line art modifier"), ICON_INFO);
return;
}
@ -633,7 +633,7 @@ static void vgroup_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetEnabled(layout, !is_baked);
if (use_cache && !is_first) {
uiItemL(layout, "Cached from the first line art modifier.", ICON_INFO);
uiItemL(layout, TIP_("Cached from the first line art modifier"), ICON_INFO);
return;
}
@ -666,7 +666,7 @@ static void bake_panel_draw(const bContext *UNUSED(C), Panel *panel)
if (is_baked) {
uiLayout *col = uiLayoutColumn(layout, false);
uiLayoutSetPropSep(col, false);
uiItemL(col, IFACE_("Modifier has baked data"), ICON_NONE);
uiItemL(col, TIP_("Modifier has baked data"), ICON_NONE);
uiItemR(
col, ptr, "is_baked", UI_ITEM_R_TOGGLE, IFACE_("Continue Without Clearing"), ICON_NONE);
}
@ -696,7 +696,7 @@ static void composition_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(layout, ptr, "use_image_boundary_trimming", 0, NULL, ICON_NONE);
if (show_in_front) {
uiItemL(layout, IFACE_("Object is shown in front"), ICON_ERROR);
uiItemL(layout, TIP_("Object is shown in front"), ICON_ERROR);
}
uiLayout *col = uiLayoutColumn(layout, false);

View File

@ -285,7 +285,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE);
uiItemL(layout, TIP_("Settings are inside the Physics tab"), ICON_NONE);
modifier_panel_end(layout, ptr);
}

View File

@ -263,7 +263,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE);
uiItemL(layout, TIP_("Settings are inside the Physics tab"), ICON_NONE);
modifier_panel_end(layout, ptr);
}

View File

@ -236,8 +236,8 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, &ob_ptr);
int decimate_type = RNA_enum_get(ptr, "decimate_type");
char count_info[32];
snprintf(count_info, 32, "%s: %d", IFACE_("Face Count"), RNA_int_get(ptr, "face_count"));
char count_info[64];
snprintf(count_info, 32, TIP_("Face Count: %d"), RNA_int_get(ptr, "face_count"));
uiItemR(layout, ptr, "decimate_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);

View File

@ -193,7 +193,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE);
uiItemL(layout, TIP_("Settings are inside the Physics tab"), ICON_NONE);
modifier_panel_end(layout, ptr);
}

View File

@ -247,7 +247,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE);
uiItemL(layout, TIP_("Settings are inside the Physics tab"), ICON_NONE);
modifier_panel_end(layout, ptr);
}

View File

@ -552,7 +552,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
modifier_panel_end(layout, ptr);
#else /* WITH_OCEANSIM */
uiItemL(layout, IFACE_("Built without Ocean modifier"), ICON_NONE);
uiItemL(layout, TIP_("Built without Ocean modifier"), ICON_NONE);
#endif /* WITH_OCEANSIM */
}

View File

@ -277,7 +277,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
ModifierData *md = (ModifierData *)ptr->data;
ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys;
uiItemL(layout, IFACE_("Settings are in the particle tab"), ICON_NONE);
uiItemL(layout, TIP_("Settings are in the particle tab"), ICON_NONE);
if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB)) {

View File

@ -273,7 +273,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
modifier_panel_end(layout, ptr);
#else /* WITH_MOD_REMESH */
uiItemL(layout, IFACE_("Built without Remesh modifier"), ICON_NONE);
uiItemL(layout, TIP_("Built without Remesh modifier"), ICON_NONE);
#endif /* WITH_MOD_REMESH */
}

View File

@ -92,7 +92,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE);
uiItemL(layout, TIP_("Settings are inside the Physics tab"), ICON_NONE);
modifier_panel_end(layout, ptr);
}

View File

@ -27,6 +27,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
@ -414,8 +415,12 @@ static void panel_draw(const bContext *C, Panel *panel)
float preview = MAX2(RNA_float_get(&cycles_ptr, "preview_dicing_rate") *
RNA_float_get(&ob_cycles_ptr, "dicing_rate"),
0.1f);
char output[64];
snprintf(output, 64, "Final Scale: Render %.2f px, Viewport %.2f px", render, preview);
char output[256];
BLI_snprintf(output,
sizeof(output),
TIP_("Final Scale: Render %.2f px, Viewport %.2f px"),
render,
preview);
uiItemL(layout, output, ICON_NONE);
uiItemS(layout);

View File

@ -207,7 +207,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL);
uiItemL(layout, IFACE_("Settings are inside the Physics tab"), ICON_NONE);
uiItemL(layout, TIP_("Settings are inside the Physics tab"), ICON_NONE);
modifier_panel_end(layout, ptr);
}

View File

@ -108,7 +108,7 @@ void modifier_panel_end(uiLayout *layout, PointerRNA *ptr)
ModifierData *md = ptr->data;
if (md->error) {
uiLayout *row = uiLayoutRow(layout, false);
uiItemL(row, IFACE_(md->error), ICON_ERROR);
uiItemL(row, TIP_(md->error), ICON_ERROR);
}
}

View File

@ -101,7 +101,7 @@ void shaderfx_panel_end(uiLayout *layout, PointerRNA *ptr)
ShaderFxData *fx = ptr->data;
if (fx->error) {
uiLayout *row = uiLayoutRow(layout, false);
uiItemL(row, IFACE_(fx->error), ICON_ERROR);
uiItemL(row, TIP_(fx->error), ICON_ERROR);
}
}

View File

@ -323,7 +323,7 @@ static uiBlock *wm_block_create_about(bContext *C, ARegion *region, void *UNUSED
uiLayout *col = uiLayoutColumn(layout, true);
uiItemL_ex(col, N_("Blender"), ICON_NONE, true, false);
uiItemL_ex(col, IFACE_("Blender"), ICON_NONE, true, false);
MenuType *mt = WM_menutype_find("WM_MT_splash_about", true);
if (mt) {