mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-29 14:27:42 +00:00
Added a class for deferred translation of strings.
This commit is contained in:
parent
cc0276ed83
commit
2a4999959b
@ -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 ; \
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user