[haiku-commits] r35968 - haiku/trunk/src/apps/aboutsystem

  • From: michael.w.pfeiffer@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 27 Mar 2010 10:19:17 +0100 (CET)

Author: laplace
Date: 2010-03-27 10:19:17 +0100 (Sat, 27 Mar 2010)
New Revision: 35968
Changeset: http://dev.haiku-os.org/changeset/35968/haiku

Modified:
   haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp
Log:
Moved translators into a table. Avoids code duplication and should make
the implementation of the open TODO (sort languages alphabetically using
collators) easy.


Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp
===================================================================
--- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp    2010-03-27 07:55:21 UTC 
(rev 35967)
+++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp    2010-03-27 09:19:17 UTC 
(rev 35968)
@@ -74,8 +74,88 @@
 static const rgb_color kHaikuYellow = { 255, 176, 0, 255 };
 static const rgb_color kLinkBlue = { 80, 80, 200, 255 };
 
+typedef struct
+{
+       const char* languageCode;
+       const char* names;
+} Translation;
 
+static const Translation gTranslations[] =
+{
+       { "bg",
+               "cssvb94\n"
+       },
+       { "nl",
+               "Meanwhile\n"
+       },
+       { "eo",
+               "Travis D. Reed (Dancxjo)\n"
+       },
+       { "fi",
+               "Jaakko Leikas (Garjala)\n"
+       },
+       { "fr",
+               "Jean-Loïc Charroud\n"
+               "Adrien Destugues (PulkoMandy)\n"
+       },
+       { "de",
+               "Colin Günther\n"
+               "leszek\n"
+               "Christian Morgenroth\n"
+               "Joachim Seemer (Humdinger)\n"
+               "Matthias Spreiter\n"
+               "svend\n"
+       },
+       { "hu",
+               "Zoltán Mizsei (miqlas)\n"
+               "Zoltán Szabó (Bird)\n"
+       },
+       { "it",
+               "Andrea Bernardi\n"
+       },
+       { "ja",
+               "Hironoru Ichimiya\n"
+               "Jorge G. Mare (Koki)\n"
+               "Takashi Murai\n"
+               "SHINTA\n"
+               "The JPBE.net user group\n"
+       },
+       { "lt",
+               "Algirdas Buckus\n"
+       },
+       { "pl",
+               "Artur Wyszyński\n"
+               "Hubert Hareńczyk\n"
+       },
+       { "pt",
+               "Marcos Alves (Xeon3D)\n"
+       },
+       { "ru",
+               "Tatyana Fursic (iceid)\n"
+               "StoroZ Gneva\n"
+               "Rustam Islamov (RISC aka HaikuBot)\n"
+               "Eugene Katashov (mrNoisy)\n"
+               "Reznikov Sergei (Diver)\n"
+               "Michael Smirnov\n"
+       },
+       { "es",
+               "Nicolás C (CapitanPico)\n"
+               "Oscar Carballal (oscarcp)\n"
+               "Miguel Zúñiga González (miguel~1.mx)\n"
+       },
+       { "sv",
+               "Johan Holmberg\n"
+               "Jimmy Olsson (phalax)\n"
+               "Victor Widell\n"
+       },
+       { "uk",
+               "Alex Rudyk (totish)\n"
+       }
+};
 
+#define kNumberOfTranslations (sizeof(gTranslations) / sizeof(Translation))
+
+
 class AboutApp : public BApplication {
 public:
                                                                AboutApp();
@@ -938,251 +1018,24 @@
        BLanguage* lang;
        BString langName;
 
-       be_locale_roster->GetLanguage(&lang, "bg");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
+       for (uint32 i = 0; i < kNumberOfTranslations; i ++) {
+               const Translation& translation = gTranslations[i];
 
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "cssvb94\n"
-       );
+               be_locale_roster->GetLanguage(&lang, translation.languageCode);
+               langName.Truncate(0);
+               lang->GetName(&langName);
+               delete lang;
 
-       be_locale_roster->GetLanguage(&lang, "nl");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
+               fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
+               fCreditsView->Insert("\n");
+               fCreditsView->Insert(langName);
+               fCreditsView->Insert("\n");
+               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&kDarkGrey);
+               fCreditsView->Insert(
+                       translation.names
+               );
+       }
 
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Meanwhile\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "eo");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Travis D. Reed (Dancxjo)\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "fi");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Jaakko Leikas (Garjala)\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "fr");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Jean-Loïc Charroud\n"
-               "Adrien Destugues (PulkoMandy)\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "de");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Colin Günther\n"
-               "leszek\n"
-               "Christian Morgenroth\n"
-               "Joachim Seemer (Humdinger)\n"
-               "Matthias Spreiter\n"
-               "svend\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "hu");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Zoltán Mizsei (miqlas)\n"
-               "Zoltán Szabó (Bird)\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "it");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Andrea Bernardi\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "ja");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Hironoru Ichimiya\n"
-               "Jorge G. Mare (Koki)\n"
-               "Takashi Murai\n"
-               "SHINTA\n"
-               "The JPBE.net user group\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "lt");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Algirdas Buckus\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "pl");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Artur Wyszyński\n"
-               "Hubert Hareńczyk\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "pt");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Marcos Alves (Xeon3D)\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "ru");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Tatyana Fursic (iceid)\n"
-               "StoroZ Gneva\n"
-               "Rustam Islamov (RISC aka HaikuBot)\n"
-               "Eugene Katashov (mrNoisy)\n"
-               "Reznikov Sergei (Diver)\n"
-               "Michael Smirnov\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "es");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Nicolás C (CapitanPico)\n"
-               "Oscar Carballal (oscarcp)\n"
-               "Miguel Zúñiga González (miguel~1.mx)\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "sv");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Johan Holmberg\n"
-               "Jimmy Olsson (phalax)\n"
-               "Victor Widell\n"
-       );
-
-       be_locale_roster->GetLanguage(&lang, "uk");
-       langName.Truncate(0);
-       lang->GetName(&langName);
-       delete lang;
-
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
-       fCreditsView->Insert("\n");
-       fCreditsView->Insert(langName);
-       fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
-       fCreditsView->Insert(
-               "Alex Rudyk (totish)\n"
-       );
-
        fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
        fCreditsView->Insert(TR("\n\nSpecial thanks to:\n"));
 


Other related posts:

  • » [haiku-commits] r35968 - haiku/trunk/src/apps/aboutsystem - michael . w . pfeiffer