diff --git a/Makefile.in b/Makefile.in index a0b4ef5fc..e333d34fd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -339,7 +339,8 @@ maintainer-clean: distclean update-po: @echo 'XGETTEXT' - @xgettext --keyword=Y --keyword=Z --keyword=TIP --default-domain=mkvtoolnix --from-code=UTF-8 -s --omit-header -o po/mkvtoolnix.pot \ + @xgettext --keyword=YT --keyword=Y --keyword=Z --keyword=TIP \ + --default-domain=mkvtoolnix --from-code=UTF-8 -s --omit-header -o po/mkvtoolnix.pot \ $(ALL_SOURCES) $(ALL_HEADERS) @for i in po/*.po ; do \ echo 'MSGMERGE ' $$i ; \ diff --git a/src/common/translation.cpp b/src/common/translation.cpp index 1d9d46d67..4cd8aff32 100644 --- a/src/common/translation.cpp +++ b/src/common/translation.cpp @@ -150,6 +150,34 @@ translation_c::get_locale() { #endif } +// ------------------------------------------------------------ + +translatable_string_c::translatable_string_c() +{ +} + +translatable_string_c::translatable_string_c(const std::string &untranslated_string) + : m_untranslated_string(untranslated_string) +{ +} + +translatable_string_c::translatable_string_c(const char *untranslated_string) + : m_untranslated_string(untranslated_string) +{ +} + +std::string +translatable_string_c::get_translated() { + return m_untranslated_string.empty() ? "" : Y(m_untranslated_string.c_str()); +} + +std::string +translatable_string_c::get_untranslated() { + return m_untranslated_string; +} + +// ------------------------------------------------------------ + #if defined(HAVE_LIBINTL_H) void diff --git a/src/common/translation.h b/src/common/translation.h index 5aa261ad4..2f34808b4 100644 --- a/src/common/translation.h +++ b/src/common/translation.h @@ -39,6 +39,21 @@ public: static std::string get_default_ui_locale(); }; +class MTX_DLL_API translatable_string_c { +protected: + std::string m_untranslated_string; + +public: + translatable_string_c(); + translatable_string_c(const std::string &untranslated_string); + translatable_string_c(const char *untranslated_string); + + std::string get_translated(); + std::string get_untranslated(); +}; + +#define YT(s) translatable_string_c(s) + void MTX_DLL_API init_locales(std::string locale = ""); #endif // __MTX_COMMON_TRANSLATION_H