blupi-games / planetblupi

Planet Blupi source code
https://www.blupi.org
Other
89 stars 22 forks source link

Add Hungarian translation #115

Open pehsa opened 8 months ago

pehsa commented 8 months ago

Adding initial hungarian translation to the game

Skywalker13 commented 7 months ago

Hi, Thank you

I review your PR asap.

Skywalker13 commented 5 months ago

Hello

I checked your work. It's very good. Nevertheless some changes are missing. You need these changes in order to enable the hungarian language in the settings panel.

image

diff --git a/src/event.cxx b/src/event.cxx
index 3220cd3..653ee75 100644
--- a/src/event.cxx
+++ b/src/event.cxx
@@ -1693,6 +1693,7 @@ CEvent::CEvent ()
     m_Languages.push_back (Language::ar);
     m_Languages.push_back (Language::es);
   }
+  m_Languages.push_back (Language::hu);

   this->m_LangStart = GetLocale ();

@@ -1716,6 +1717,8 @@ CEvent::CEvent ()
     m_Lang = m_Languages.begin () + 9;
   else if (this->m_LangStart == "es" && !(g_settingsOverload & SETTING_LEGACY))
     m_Lang = m_Languages.begin () + 10;
+  else if (this->m_LangStart == "hu")
+    m_Lang = m_Languages.begin () + 11;
   else
     m_Lang = m_Languages.begin ();

@@ -4216,6 +4219,8 @@ CEvent::GetStartLanguage ()
     return Language::ar;
   if (this->m_LangStart == "es" && !(g_settingsOverload & SETTING_LEGACY))
     return Language::es;
+  if (this->m_LangStart == "hu")
+    return Language::hu;
   return Language::en;
 }

@@ -4271,6 +4276,9 @@ CEvent::SetLanguage (Language lang)
   case Language::es:
     slang = "es";
     break;
+  case Language::hu:
+    slang = "hu";
+    break;
   }

   snprintf (env, sizeof (env), "LANGUAGE=%s", slang);
diff --git a/src/event.h b/src/event.h
index b9d4a41..f364b93 100644
--- a/src/event.h
+++ b/src/event.h
@@ -90,6 +90,7 @@ enum class Language {
   he    = 8,
   ar    = 9,
   es    = 10,
+  hu    = 11,
   end,
 };

Finally, the hu.po file is a little bit malformed but it's not fatal. It's not necessary that I provide the whole fixed hu.po file here. If you set properly the charset, then everything will going fine.

-"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Type: text/plain; charset=UTF-8\n"