| 775 | { |
| 776 | GStringTable.Clear(); |
| 777 | ++GLanguageGeneration; |
| 778 | } |
| 779 | |
| 780 | // Language-change callback registry |
| 781 | |
| 782 | struct LangCallbackEntry |
| 783 | { |
| 784 | int token; |
| 785 | LanguageChangedCallback cb; |
| 786 | }; |
| 787 | |
| 788 | // Leaked on exit by design: UI dialogs (e.g. DisplayMain) unregister from their |
| 789 | // destructors, which may run during static destruction. If this vector had |
| 790 | // already been destroyed, the unregister would crash. Leaking a few bytes on |
| 791 | // shutdown is the price for crash-free teardown. |
| 792 | static std::vector<LangCallbackEntry>& GetLangCallbacks() |
| 793 | { |
| 794 | static std::vector<LangCallbackEntry>* callbacks = new std::vector<LangCallbackEntry>(); |
| 795 | return *callbacks; |
| 796 | } |
| 797 | |
| 798 | static int& NextLangToken() |
| 799 | { |
| 800 | static int token = 0; |
| 801 | return token; |
| 802 | } |
| 803 | |
| 804 | int RegisterLanguageChangedCallback(LanguageChangedCallback cb) |