File tree Expand file tree Collapse file tree 1 file changed +26
-7
lines changed
Library/Sources/Framework Expand file tree Collapse file tree 1 file changed +26
-7
lines changed Original file line number Diff line number Diff line change 33#include " ../../../Includes/stdafx.hpp"
44
55namespace CTRPluginFramework {
6+ // Define an enumeration for supported languages
67 enum Lang {
7- ENG,
8- FRE
8+ ENG, // English
9+ FRE // French
910 };
1011
11- // Global to keep the current language
12- Lang g_language = ENG;
12+ // Language class to manage the current language setting and provide translation functionality
13+ class Language {
14+ public:
15+ // Constructor to initialize the current language to English by default
16+ Language () : m_currentLanguage(ENG) {}
1317
14- string AutoLanguage (string english, string french) {
15- return (g_language == ENG ? english : french);
16- }
18+ // Function to set the current language
19+ void setLanguage (Lang lang) {
20+ m_currentLanguage = lang;
21+ }
22+
23+ // Function to get the current language
24+ Lang getLanguage () const {
25+ return m_currentLanguage;
26+ }
27+
28+ // Function to automatically choose the correct translation based on the current language setting
29+ string autoLanguage (string english, string french) const {
30+ return (m_currentLanguage == ENG ? english : french);
31+ }
32+
33+ private:
34+ Lang m_currentLanguage; // Member variable to store the current language setting
35+ };
1736}
You can’t perform that action at this time.
0 commit comments