Merge master.
[dcpomatic.git] / src / wx / wx_util.cc
index aac35e97a4a1a2b2eb4ba5b78b81f0eeb1b3a697..94a08f37289625eaf4c660ab4ba5c81d6b5cab36 100644 (file)
@@ -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;
+}