L10n.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright (c) 2008-2022 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include "Sample.h"
  5. /// Localization example.
  6. /// This sample demonstrates:
  7. /// - Loading a collection of strings from JSON-files
  8. /// - Creating text elements that automatically translates itself by changing the language
  9. /// - The manually reaction to change language
  10. class L10n : public Sample
  11. {
  12. URHO3D_OBJECT(L10n, Sample);
  13. public:
  14. /// Construct.
  15. explicit L10n(Context* context);
  16. /// Setup after engine initialization and before running the main loop.
  17. void Start() override;
  18. private:
  19. // Load strings from JSON files and subscribe to the change language event
  20. void InitLocalizationSystem();
  21. // Init the 3D space
  22. void CreateScene();
  23. // Init the user interface
  24. void CreateGUI();
  25. /// Handle the logic update event.
  26. void HandleUpdate(StringHash eventType, VariantMap& eventData);
  27. // Handle the change language event.
  28. void HandleChangeLanguage(StringHash eventType, VariantMap& eventData);
  29. // Hook up to the buttons pressing
  30. void HandleChangeLangButtonPressed(StringHash eventType, VariantMap& eventData);
  31. void HandleQuitButtonPressed(StringHash eventType, VariantMap& eventData);
  32. };