X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fi18n_hook.cc;h=b2cd6df8e7f5e1af60ff0179cb2673bac43422b1;hb=3044ef060894c62e8a1cef15ad14078001093982;hp=f7bc4829ddf908555781f478602b949880161ed5;hpb=d12f444eadb2aafbc61b8b62006d9aa85fc40ba7;p=dcpomatic.git diff --git a/src/wx/i18n_hook.cc b/src/wx/i18n_hook.cc index f7bc4829d..b2cd6df8e 100644 --- a/src/wx/i18n_hook.cc +++ b/src/wx/i18n_hook.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2018 Carl Hetherington + Copyright (C) 2018-2019 Carl Hetherington This file is part of DCP-o-matic. @@ -24,10 +24,15 @@ #include "lib/cross.h" #include #include -#include -I18NHook::I18NHook (wxWindow* window) +using std::map; +using std::string; + +map I18NHook::_translations; + +I18NHook::I18NHook (wxWindow* window, wxString original) : _window (window) + , _original (original) { _window->Bind (wxEVT_MIDDLE_DOWN, bind(&I18NHook::handle, this, _1)); } @@ -35,11 +40,10 @@ I18NHook::I18NHook (wxWindow* window) void I18NHook::handle (wxMouseEvent& ev) { - wxString const original = get_text (); - InstantI18NDialog* d = new InstantI18NDialog (_window, get_text()); d->ShowModal(); set_text (d->get()); + d->Destroy (); wxWindow* w = _window; while (w) { @@ -51,14 +55,5 @@ I18NHook::handle (wxMouseEvent& ev) ev.Skip (); - boost::filesystem::path file = "instant_i18n"; - - FILE* f = fopen_boost (file, "a"); - if (!f) { - error_dialog (_window, wxString::Format(_("Could not open translation file %s"), std_to_wx(file.string()).data())); - return; - } - fprintf (f, "%s\n", wx_to_std(original).c_str()); - fprintf (f, "%s\n", wx_to_std(get_text()).c_str()); - fclose (f); + _translations[wx_to_std(_original)] = wx_to_std(get_text()); }