X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fwx_util.cc;h=cf8b75dd24b78a66a6c0c7438514ca2b57bd2292;hb=3e12c68dc0451e73b5bc1a84d1d70f4999f7b4b5;hp=aac35e97a4a1a2b2eb4ba5b78b81f0eeb1b3a697;hpb=04533b9cf34ce8089113015715083ee9c5b2b001;p=dcpomatic.git diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index aac35e97a..cf8b75dd2 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2014 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -312,10 +312,20 @@ wx_get (wxSpinCtrlDouble* w) return w->GetValue (); } -void -run_gui_loop () +/** @param s String of the form Context|String + * @return translation, or String if no translation is available. + */ +wxString +context_translation (wxString s) { - while (wxTheApp->Pending ()) { - wxTheApp->Dispatch (); + 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; }