X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Fwx_util.cc;h=94a08f37289625eaf4c660ab4ba5c81d6b5cab36;hp=aac35e97a4a1a2b2eb4ba5b78b81f0eeb1b3a697;hb=f0edd6ab35c3c2b7800a26ec8206adab75e5f633;hpb=6d26c4afe1e2b63d346d311ceffe41bf8cb62572 diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index aac35e97a..94a08f372 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -319,3 +319,21 @@ run_gui_loop () wxTheApp->Dispatch (); } } + +/** @param s String of the form Context|String + * @return translation, or String if no translation is available. + */ +wxString +context_translation (wxString s) +{ + wxString t = wxGetTranslation (s); + if (t == s) { + /* No translation; strip the context */ + int c = t.Find (wxT ("|")); + if (c != wxNOT_FOUND) { + t = t.Mid (c + 1); + } + } + + return t; +}