mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-24 04:15:11 +00:00
ui: Fix support for disambiguation in translations
This commit is contained in:
parent
36976cb550
commit
59950bec3b
1 changed files with 11 additions and 3 deletions
|
@ -209,9 +209,17 @@ streamfx::ui::translator::~translator() {}
|
|||
QString streamfx::ui::translator::translate(const char* context, const char* sourceText, const char* disambiguation,
|
||||
int n) const
|
||||
{
|
||||
if (sourceText) {
|
||||
std::string_view sourceView{sourceText};
|
||||
if (sourceView.substr(0, _i18n_prefix.length()) == _i18n_prefix) {
|
||||
return QString::fromUtf8(D_TRANSLATE(sourceView.substr(_i18n_prefix.length()).data()));
|
||||
}
|
||||
}
|
||||
if (disambiguation) {
|
||||
std::string_view disambiguationView{disambiguation};
|
||||
if (disambiguationView.substr(0, _i18n_prefix.length()) == _i18n_prefix) {
|
||||
return QString::fromUtf8(D_TRANSLATE(disambiguationView.substr(_i18n_prefix.length()).data()));
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue