I18n: extract a few messages
A few new messages were extracted. - "Catalog", the default name when creating a new catalog. - Tooltips related to drag and dropping catalogs in the asset browser. Some use `fmt::format()` as a possible solution to messages currently extracted with string concatenation as mentioned in #92758. Pull Request: https://projects.blender.org/blender/blender/pulls/107710
This commit is contained in:
@@ -462,7 +462,7 @@ static int asset_catalog_new_exec(bContext *C, wmOperator *op)
|
||||
char *parent_path = RNA_string_get_alloc(op->ptr, "parent_path", nullptr, 0, nullptr);
|
||||
|
||||
blender::asset_system::AssetCatalog *new_catalog = ED_asset_catalog_add(
|
||||
asset_library, "Catalog", parent_path);
|
||||
asset_library, DATA_("Catalog"), parent_path);
|
||||
|
||||
if (sfile) {
|
||||
ED_fileselect_activate_asset_catalog(sfile, new_catalog->catalog_id);
|
||||
|
||||
@@ -17,6 +17,7 @@ set(INC
|
||||
../../windowmanager
|
||||
../../../../intern/atomic
|
||||
../../../../intern/guardedalloc
|
||||
../../../../extern/fmtlib/include
|
||||
|
||||
# dna_type_offsets.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../../makesdna/intern
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
#include "file_intern.h"
|
||||
#include "filelist.h"
|
||||
|
||||
#define FMT_HEADER_ONLY
|
||||
#include <fmt/format.h>
|
||||
|
||||
using namespace blender;
|
||||
using namespace blender::asset_system;
|
||||
|
||||
@@ -373,11 +376,11 @@ bool AssetCatalogDropTarget::can_drop(const wmDrag &drag, const char **r_disable
|
||||
* path and the catalog system will generate missing parents from the path). But it does
|
||||
* appear broken to users, so disabling entirely. */
|
||||
if (catalog_item_.catalog_path().is_contained_in(drag_catalog->path)) {
|
||||
*r_disabled_hint = "Catalog cannot be dropped into itself";
|
||||
*r_disabled_hint = TIP_("Catalog cannot be dropped into itself");
|
||||
return false;
|
||||
}
|
||||
if (catalog_item_.catalog_path() == drag_catalog->path.parent()) {
|
||||
*r_disabled_hint = "Catalog is already placed inside this catalog";
|
||||
*r_disabled_hint = TIP_("Catalog is already placed inside this catalog");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -401,8 +404,8 @@ std::string AssetCatalogDropTarget::drop_tooltip_asset_catalog(const wmDrag &dra
|
||||
BLI_assert(drag.type == WM_DRAG_ASSET_CATALOG);
|
||||
const AssetCatalog *src_catalog = get_drag_catalog(drag, get_asset_library());
|
||||
|
||||
return std::string(TIP_("Move Catalog")) + " '" + src_catalog->path.name() + "' " +
|
||||
TIP_("into") + " '" + catalog_item_.get_name() + "'";
|
||||
return fmt::format(
|
||||
TIP_("Move catalog {} into {}"), src_catalog->path.name(), catalog_item_.get_name());
|
||||
}
|
||||
|
||||
std::string AssetCatalogDropTarget::drop_tooltip_asset_list(const wmDrag &drag) const
|
||||
@@ -523,7 +526,7 @@ bool AssetCatalogDropTarget::can_modify_catalogs(const ::AssetLibrary &library,
|
||||
const char **r_disabled_hint)
|
||||
{
|
||||
if (ED_asset_catalogs_read_only(library)) {
|
||||
*r_disabled_hint = "Catalogs cannot be edited in this asset library";
|
||||
*r_disabled_hint = TIP_("Catalogs cannot be edited in this asset library");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -602,7 +605,7 @@ bool AssetCatalogTreeViewAllItem::DropTarget::can_drop(const wmDrag &drag,
|
||||
|
||||
const AssetCatalog *drag_catalog = AssetCatalogDropTarget::get_drag_catalog(drag, library);
|
||||
if (drag_catalog->path.parent() == "") {
|
||||
*r_disabled_hint = "Catalog is already placed at the highest level";
|
||||
*r_disabled_hint = TIP_("Catalog is already placed at the highest level");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -615,8 +618,8 @@ std::string AssetCatalogTreeViewAllItem::DropTarget::drop_tooltip(const wmDrag &
|
||||
const AssetCatalog *drag_catalog = AssetCatalogDropTarget::get_drag_catalog(
|
||||
drag, *get_view<AssetCatalogTreeView>().asset_library_);
|
||||
|
||||
return std::string(TIP_("Move Catalog")) + " '" + drag_catalog->path.name() + "' " +
|
||||
TIP_("to the top level of the tree");
|
||||
return fmt::format(TIP_("Move catalog {} to the top level of the tree"),
|
||||
drag_catalog->path.name());
|
||||
}
|
||||
|
||||
bool AssetCatalogTreeViewAllItem::DropTarget::on_drop(struct bContext * /*C*/,
|
||||
|
||||
Reference in New Issue
Block a user