Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Picard <pioverfour>2022-08-23 12:43:39 +0300
committerBastien Montagne <bastien@blender.org>2022-08-23 12:54:34 +0300
commit4ac96a483bf1567d37ec0357c5430c731c4f884e (patch)
tree376ced2dae9f4b288707574be1a84d7fdf4cbfda /source/blender/editors/screen
parent22fdb88be525fbefb77c17fe69956e1e367c747e (diff)
I18n: make workspaces translatable
This makes workspaces more translatable: - New Workspace menu - header - preset menus - preset entries - workspace names upon factory file template load - new workspace name upon workspace addition To properly translate those names, an extraction function for workspace names from app templates was added as well. (Do not do anything when loading a user-saved file!) Reviewed By: mont29 Differential Revision: https://developer.blender.org/D15727
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r--source/blender/editors/screen/workspace_edit.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index fc3ac53ef0b..e1ebd3932d1 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -359,6 +359,11 @@ static int workspace_append_activate_exec(bContext *C, wmOperator *op)
BLO_LIBLINK_APPEND_RECURSIVE);
if (appended_workspace) {
+ if (BLT_translate_new_dataname()) {
+ /* Translate workspace name */
+ BKE_libblock_rename(bmain, &appended_workspace->id, CTX_DATA_(BLT_I18NCONTEXT_ID_WORKSPACE, idname));
+ }
+
/* Set defaults. */
BLO_update_defaults_workspace(appended_workspace, NULL);
@@ -442,7 +447,7 @@ static void workspace_append_button(uiLayout *layout,
PointerRNA opptr;
uiItemFullO_ptr(
- layout, ot_append, workspace->id.name + 2, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &opptr);
+ layout, ot_append, CTX_DATA_(BLT_I18NCONTEXT_ID_WORKSPACE, workspace->id.name + 2), ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &opptr);
RNA_string_set(&opptr, "idname", id->name + 2);
RNA_string_set(&opptr, "filepath", filepath);
}
@@ -495,7 +500,8 @@ static void workspace_add_menu(bContext *UNUSED(C), uiLayout *layout, void *temp
static int workspace_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
- uiPopupMenu *pup = UI_popup_menu_begin(C, op->type->name, ICON_ADD);
+ uiPopupMenu *pup = UI_popup_menu_begin(C, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT,
+ op->type->name), ICON_ADD);
uiLayout *layout = UI_popup_menu_layout(pup);
uiItemMenuF(layout, IFACE_("General"), ICON_NONE, workspace_add_menu, NULL);
@@ -507,7 +513,7 @@ static int workspace_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
char *template = link->data;
char display_name[FILE_MAX];
- BLI_path_to_display_name(display_name, sizeof(display_name), template);
+ BLI_path_to_display_name(display_name, sizeof(display_name), IFACE_(template));
/* Steals ownership of link data string. */
uiItemMenuFN(layout, display_name, ICON_NONE, workspace_add_menu, template);