Files
test2/source/blender/blentranslation/intern/messages.hh
Hans Goudey 4f833b0b5f Refactor: Add StringRef overloads to translation functions
Currently UI code always has to use char pointers when interacting with
the translation system. This makes benefiting from the use C++ strings
and StringRef more difficult. That means we're leaving some type safety
and performance on the table. This PR adds StringRef overloads to the
translation API functions and removes the few calls to `.c_str()` that
are now unnecessary.

Pull Request: https://projects.blender.org/blender/blender/pulls/133887
2025-02-06 17:47:52 +01:00

32 lines
773 B
C++

/* SPDX-FileCopyrightText: 2025 Blender Authors
*
* SPDX-License-Identifier: BSL-1.0 */
/** \file
* \ingroup blt
*
* Adapted from `boost::locale`.
*/
#include <optional>
#include <string>
#include "BLI_string_ref.hh"
#include "BLI_vector.hh"
namespace blender::locale {
void init(const StringRef locale_full_name, /* Local name. */
const Vector<std::string> &domains, /* Application names. */
const Vector<std::string> &paths); /* Search paths for .mo files. */
void free();
std::optional<StringRefNull> translate(int domain, StringRef context, StringRef key);
const char *full_name();
#if defined(__APPLE__) && !defined(WITH_HEADLESS) && !defined(WITH_GHOST_SDL)
std::string macos_user_locale();
#endif
} // namespace blender::locale