From: Michael Tremer Date: Thu, 9 Apr 2015 17:05:56 +0000 (+0200) Subject: donate: Fix PayPal locale X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=069e18f536f80cdcebed298de60e197f4563131f;p=ipfire.org.git donate: Fix PayPal locale --- diff --git a/templates/modules/donation-button.html b/templates/modules/donation-button.html index 60bfa356..f70127d1 100644 --- a/templates/modules/donation-button.html +++ b/templates/modules/donation-button.html @@ -1,7 +1,7 @@
- + diff --git a/translations/de/LC_MESSAGES/webapp.po b/translations/de/LC_MESSAGES/webapp.po index cf7c5cc5..86e06b0a 100644 --- a/translations/de/LC_MESSAGES/webapp.po +++ b/translations/de/LC_MESSAGES/webapp.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-03-29 23:50+0200\n" +"POT-Creation-Date: 2015-04-09 19:03+0200\n" "PO-Revision-Date: 2015-03-29 23:55+0100\n" "Last-Translator: Michael Tremer \n" "Language-Team: LANGUAGE \n" @@ -1232,119 +1232,119 @@ msgstr "Ein fertiges Image für Xen." msgid "Generator for creating a Xen image." msgstr "Generator zum Erstellen einex Xen-Images." -#: webapp/__init__.py:353 +#: webapp/__init__.py:355 #: /usr/lib/python2.7/site-packages/tornado/locale.py:235 #: /usr/lib/python3.3/site-packages/tornado/locale.py:235 msgid "January" msgstr "Januar" -#: webapp/__init__.py:355 +#: webapp/__init__.py:357 #: /usr/lib/python2.7/site-packages/tornado/locale.py:235 #: /usr/lib/python3.3/site-packages/tornado/locale.py:235 msgid "February" msgstr "Februar" -#: webapp/__init__.py:357 +#: webapp/__init__.py:359 #: /usr/lib/python2.7/site-packages/tornado/locale.py:235 #: /usr/lib/python3.3/site-packages/tornado/locale.py:235 msgid "March" msgstr "März" -#: webapp/__init__.py:359 +#: webapp/__init__.py:361 #: /usr/lib/python2.7/site-packages/tornado/locale.py:235 #: /usr/lib/python3.3/site-packages/tornado/locale.py:235 msgid "April" msgstr "April" -#: webapp/__init__.py:361 +#: webapp/__init__.py:363 #: /usr/lib/python2.7/site-packages/tornado/locale.py:236 #: /usr/lib/python3.3/site-packages/tornado/locale.py:236 msgid "May" msgstr "Mai" -#: webapp/__init__.py:363 +#: webapp/__init__.py:365 #: /usr/lib/python2.7/site-packages/tornado/locale.py:236 #: /usr/lib/python3.3/site-packages/tornado/locale.py:236 msgid "June" msgstr "Juni" -#: webapp/__init__.py:365 +#: webapp/__init__.py:367 #: /usr/lib/python2.7/site-packages/tornado/locale.py:236 #: /usr/lib/python3.3/site-packages/tornado/locale.py:236 msgid "July" msgstr "Juli" -#: webapp/__init__.py:367 +#: webapp/__init__.py:369 #: /usr/lib/python2.7/site-packages/tornado/locale.py:236 #: /usr/lib/python3.3/site-packages/tornado/locale.py:236 msgid "August" msgstr "August" -#: webapp/__init__.py:369 +#: webapp/__init__.py:371 #: /usr/lib/python2.7/site-packages/tornado/locale.py:237 #: /usr/lib/python3.3/site-packages/tornado/locale.py:237 msgid "September" msgstr "September" -#: webapp/__init__.py:371 +#: webapp/__init__.py:373 #: /usr/lib/python2.7/site-packages/tornado/locale.py:237 #: /usr/lib/python3.3/site-packages/tornado/locale.py:237 msgid "October" msgstr "Oktober" -#: webapp/__init__.py:373 +#: webapp/__init__.py:375 #: /usr/lib/python2.7/site-packages/tornado/locale.py:237 #: /usr/lib/python3.3/site-packages/tornado/locale.py:237 msgid "November" msgstr "November" -#: webapp/__init__.py:375 +#: webapp/__init__.py:377 #: /usr/lib/python2.7/site-packages/tornado/locale.py:237 #: /usr/lib/python3.3/site-packages/tornado/locale.py:237 msgid "December" msgstr "Dezember" -#: webapp/ui_modules.py:135 +#: webapp/ui_modules.py:132 msgid "German" msgstr "Deutsch" -#: webapp/ui_modules.py:137 +#: webapp/ui_modules.py:134 msgid "English" msgstr "Englisch" -#: webapp/ui_modules.py:139 +#: webapp/ui_modules.py:136 msgid "Spanish" msgstr "Spanisch" -#: webapp/ui_modules.py:141 +#: webapp/ui_modules.py:138 msgid "French" msgstr "Französisch" -#: webapp/ui_modules.py:143 +#: webapp/ui_modules.py:140 msgid "Italian" msgstr "Italienisch" -#: webapp/ui_modules.py:145 +#: webapp/ui_modules.py:142 msgid "Dutch" msgstr "Niederländisch" -#: webapp/ui_modules.py:147 +#: webapp/ui_modules.py:144 msgid "Polish" msgstr "Polnisch" -#: webapp/ui_modules.py:149 +#: webapp/ui_modules.py:146 msgid "Portuguese" msgstr "Portugiesisch" -#: webapp/ui_modules.py:151 +#: webapp/ui_modules.py:148 msgid "Russian" msgstr "Russisch" -#: webapp/ui_modules.py:153 +#: webapp/ui_modules.py:150 msgid "Turkish" msgstr "Türkisch" -#: webapp/ui_modules.py:207 webapp/handlers_news.py:43 +#: webapp/ui_modules.py:204 webapp/handlers_news.py:43 msgid "Unknown author" msgstr "Unbekannter Autor" @@ -1557,7 +1557,7 @@ msgid "Virtualization" msgstr "Virtualisierung" #: templates/fireinfo/stats.html:3 templates/fireinfo/stats-admin.html:6 -#: templates/modules/menu.html:149 +#: templates/modules/menu.html:155 msgid "Statistics" msgstr "Statistiken" @@ -1636,7 +1636,7 @@ msgid "Here are some random profiles which have this device:" msgstr "Hier sind einige Profile mit diesem Gerät:" #: templates/fireinfo/stats-admin.html:3 templates/fireinfo/base.html:6 -#: templates/modules/menu.html:111 templates/modules/menu.html:136 +#: templates/modules/menu.html:111 templates/modules/menu.html:142 msgid "Fireinfo" msgstr "Fireinfo" @@ -1958,8 +1958,8 @@ msgstr "Informiere dich" #: templates/news.html:61 templates/planet/search.html:3 #: templates/planet/year.html:3 templates/planet/user.html:3 -#: templates/planet/posting.html:3 templates/planet/index.html:3 -#: templates/planet/base.html:6 templates/index.html:169 +#: templates/planet/index.html:3 templates/planet/base.html:6 +#: templates/index.html:169 msgid "IPFire Planet" msgstr "IPFire Planet" @@ -2267,12 +2267,12 @@ msgid "Call Log" msgstr "Anrufe" #: templates/talk/phonebook.html:3 templates/talk/phonebook.html:7 -#: templates/modules/menu.html:153 +#: templates/modules/menu.html:163 msgid "Phonebook" msgstr "Telefonbuch" #: templates/talk/diagnosis.html:3 templates/talk/diagnosis.html:7 -#: templates/modules/menu.html:167 +#: templates/modules/menu.html:177 msgid "Diagnosis" msgstr "Diagnose" @@ -2296,7 +2296,7 @@ msgid "Back" msgstr "Zurück" #: templates/talk/trunks.html:3 templates/talk/trunks.html:6 -#: templates/modules/menu.html:162 +#: templates/modules/menu.html:172 msgid "Trunks" msgstr "Trunks" @@ -2345,7 +2345,7 @@ msgid "missed call" msgstr "verpasster Anruf" #: templates/talk/conferences.html:3 templates/talk/conferences.html:7 -#: templates/modules/menu.html:157 +#: templates/modules/menu.html:167 msgid "Conferences" msgstr "Konferenzen" @@ -2529,6 +2529,8 @@ msgstr "Für Privatanwender" #: templates/static/hardware.html:37 templates/static/hardware.html:124 #: templates/static/hardware.html:242 templates/modules/news-preview.html:6 +#: templates/modules/planet-entry.html:13 templates/planet/posting.html:13 +#: templates/planet/hottest.html:14 msgid "by" msgstr "von" @@ -2731,7 +2733,7 @@ msgid "Please use the support forums to get help with your IPFire system." msgstr "Bitte nutzt das Supportforum." #: templates/static/imprint.html:40 templates/static/imprint.html:60 -#: templates/static/imprint.html:80 templates/planet/user.html:53 +#: templates/static/imprint.html:80 msgid "Mail" msgstr "Mail" @@ -2851,14 +2853,6 @@ msgstr "BIC-/SWIFT-Code" msgid "Reason for transfer" msgstr "Verwendungszweck" -#: templates/modules/planet-entry.html:14 templates/planet/posting.html:22 -msgid "Posted by" -msgstr "Erstellt von" - -#: templates/modules/planet-entry.html:15 templates/planet/posting.html:23 -msgid "on" -msgstr "am" - #: templates/modules/news-item.html:6 msgid "Announcement" msgstr "Ankündigung" @@ -2947,27 +2941,31 @@ msgstr "Verschiedenes" msgid "Mirrors" msgstr "Mirrors" -#: templates/modules/menu.html:123 +#: templates/modules/menu.html:129 msgid "CeBIT" msgstr "CeBIT" -#: templates/modules/menu.html:129 +#: templates/modules/menu.html:135 msgid "Tracker" msgstr "Tracker" -#: templates/modules/menu.html:139 +#: templates/modules/menu.html:145 msgid "Planet" msgstr "Planet" -#: templates/modules/menu.html:142 +#: templates/modules/menu.html:148 msgid "Downloads" msgstr "Downloads" -#: templates/modules/menu.html:146 +#: templates/modules/menu.html:152 msgid "Device Vendors" msgstr "Gerätehersteller" -#: templates/modules/menu.html:187 +#: templates/modules/menu.html:159 templates/planet/hottest.html:3 +msgid "Hottest posts" +msgstr "" + +#: templates/modules/menu.html:197 msgid "Professional support available!" msgstr "Professioneller Support verfügbar!" @@ -3007,14 +3005,18 @@ msgstr "Neuere Beiträge" msgid "%s did not write any posts, yet." msgstr "%s hat bisher noch keine Beiträge verfasst." -#: templates/planet/posting.html:15 +#: templates/planet/posting.html:22 msgid "Heads up!" msgstr "Achtung!" -#: templates/planet/posting.html:15 +#: templates/planet/posting.html:22 msgid "This post is a draft and has not been published, yet." msgstr "Dieser Post ist ein Entwurf und noch nicht veröffentlicht." +#: templates/planet/hottest.html:8 +msgid "The hottest posts of the last month" +msgstr "" + #: templates/planet/base.html:9 msgid "The official blog of the IPFire team" msgstr "Das offizielle Blog des IPFire-Team" @@ -3339,6 +3341,12 @@ msgstr "%(weekday)s, %(day)s. %(month_name)s" msgid "%(commas)s and %(last)s" msgstr "%(commas)s und %(last)s" +#~ msgid "Posted by" +#~ msgstr "Erstellt von" + +#~ msgid "on" +#~ msgstr "am" + #~ msgid "We need your help!" #~ msgstr "Wir brauchen Deine Hilfe!" diff --git a/translations/webapp.pot b/translations/webapp.pot index 6aab9266..67cbed83 100644 --- a/translations/webapp.pot +++ b/translations/webapp.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-03-29 23:50+0200\n" +"POT-Creation-Date: 2015-04-09 19:03+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1230,119 +1230,119 @@ msgstr "" msgid "Generator for creating a Xen image." msgstr "" -#: webapp/__init__.py:353 +#: webapp/__init__.py:355 #: /usr/lib/python2.7/site-packages/tornado/locale.py:235 #: /usr/lib/python3.3/site-packages/tornado/locale.py:235 msgid "January" msgstr "" -#: webapp/__init__.py:355 +#: webapp/__init__.py:357 #: /usr/lib/python2.7/site-packages/tornado/locale.py:235 #: /usr/lib/python3.3/site-packages/tornado/locale.py:235 msgid "February" msgstr "" -#: webapp/__init__.py:357 +#: webapp/__init__.py:359 #: /usr/lib/python2.7/site-packages/tornado/locale.py:235 #: /usr/lib/python3.3/site-packages/tornado/locale.py:235 msgid "March" msgstr "" -#: webapp/__init__.py:359 +#: webapp/__init__.py:361 #: /usr/lib/python2.7/site-packages/tornado/locale.py:235 #: /usr/lib/python3.3/site-packages/tornado/locale.py:235 msgid "April" msgstr "" -#: webapp/__init__.py:361 +#: webapp/__init__.py:363 #: /usr/lib/python2.7/site-packages/tornado/locale.py:236 #: /usr/lib/python3.3/site-packages/tornado/locale.py:236 msgid "May" msgstr "" -#: webapp/__init__.py:363 +#: webapp/__init__.py:365 #: /usr/lib/python2.7/site-packages/tornado/locale.py:236 #: /usr/lib/python3.3/site-packages/tornado/locale.py:236 msgid "June" msgstr "" -#: webapp/__init__.py:365 +#: webapp/__init__.py:367 #: /usr/lib/python2.7/site-packages/tornado/locale.py:236 #: /usr/lib/python3.3/site-packages/tornado/locale.py:236 msgid "July" msgstr "" -#: webapp/__init__.py:367 +#: webapp/__init__.py:369 #: /usr/lib/python2.7/site-packages/tornado/locale.py:236 #: /usr/lib/python3.3/site-packages/tornado/locale.py:236 msgid "August" msgstr "" -#: webapp/__init__.py:369 +#: webapp/__init__.py:371 #: /usr/lib/python2.7/site-packages/tornado/locale.py:237 #: /usr/lib/python3.3/site-packages/tornado/locale.py:237 msgid "September" msgstr "" -#: webapp/__init__.py:371 +#: webapp/__init__.py:373 #: /usr/lib/python2.7/site-packages/tornado/locale.py:237 #: /usr/lib/python3.3/site-packages/tornado/locale.py:237 msgid "October" msgstr "" -#: webapp/__init__.py:373 +#: webapp/__init__.py:375 #: /usr/lib/python2.7/site-packages/tornado/locale.py:237 #: /usr/lib/python3.3/site-packages/tornado/locale.py:237 msgid "November" msgstr "" -#: webapp/__init__.py:375 +#: webapp/__init__.py:377 #: /usr/lib/python2.7/site-packages/tornado/locale.py:237 #: /usr/lib/python3.3/site-packages/tornado/locale.py:237 msgid "December" msgstr "" -#: webapp/ui_modules.py:135 +#: webapp/ui_modules.py:132 msgid "German" msgstr "" -#: webapp/ui_modules.py:137 +#: webapp/ui_modules.py:134 msgid "English" msgstr "" -#: webapp/ui_modules.py:139 +#: webapp/ui_modules.py:136 msgid "Spanish" msgstr "" -#: webapp/ui_modules.py:141 +#: webapp/ui_modules.py:138 msgid "French" msgstr "" -#: webapp/ui_modules.py:143 +#: webapp/ui_modules.py:140 msgid "Italian" msgstr "" -#: webapp/ui_modules.py:145 +#: webapp/ui_modules.py:142 msgid "Dutch" msgstr "" -#: webapp/ui_modules.py:147 +#: webapp/ui_modules.py:144 msgid "Polish" msgstr "" -#: webapp/ui_modules.py:149 +#: webapp/ui_modules.py:146 msgid "Portuguese" msgstr "" -#: webapp/ui_modules.py:151 +#: webapp/ui_modules.py:148 msgid "Russian" msgstr "" -#: webapp/ui_modules.py:153 +#: webapp/ui_modules.py:150 msgid "Turkish" msgstr "" -#: webapp/ui_modules.py:207 webapp/handlers_news.py:43 +#: webapp/ui_modules.py:204 webapp/handlers_news.py:43 msgid "Unknown author" msgstr "" @@ -1555,7 +1555,7 @@ msgid "Virtualization" msgstr "" #: templates/fireinfo/stats.html:3 templates/fireinfo/stats-admin.html:6 -#: templates/modules/menu.html:149 +#: templates/modules/menu.html:155 msgid "Statistics" msgstr "" @@ -1634,7 +1634,7 @@ msgid "Here are some random profiles which have this device:" msgstr "" #: templates/fireinfo/stats-admin.html:3 templates/fireinfo/base.html:6 -#: templates/modules/menu.html:111 templates/modules/menu.html:136 +#: templates/modules/menu.html:111 templates/modules/menu.html:142 msgid "Fireinfo" msgstr "" @@ -1954,8 +1954,8 @@ msgstr "" #: templates/news.html:61 templates/planet/search.html:3 #: templates/planet/year.html:3 templates/planet/user.html:3 -#: templates/planet/posting.html:3 templates/planet/index.html:3 -#: templates/planet/base.html:6 templates/index.html:169 +#: templates/planet/index.html:3 templates/planet/base.html:6 +#: templates/index.html:169 msgid "IPFire Planet" msgstr "" @@ -2260,12 +2260,12 @@ msgid "Call Log" msgstr "" #: templates/talk/phonebook.html:3 templates/talk/phonebook.html:7 -#: templates/modules/menu.html:153 +#: templates/modules/menu.html:163 msgid "Phonebook" msgstr "" #: templates/talk/diagnosis.html:3 templates/talk/diagnosis.html:7 -#: templates/modules/menu.html:167 +#: templates/modules/menu.html:177 msgid "Diagnosis" msgstr "" @@ -2289,7 +2289,7 @@ msgid "Back" msgstr "" #: templates/talk/trunks.html:3 templates/talk/trunks.html:6 -#: templates/modules/menu.html:162 +#: templates/modules/menu.html:172 msgid "Trunks" msgstr "" @@ -2338,7 +2338,7 @@ msgid "missed call" msgstr "" #: templates/talk/conferences.html:3 templates/talk/conferences.html:7 -#: templates/modules/menu.html:157 +#: templates/modules/menu.html:167 msgid "Conferences" msgstr "" @@ -2521,6 +2521,8 @@ msgstr "" #: templates/static/hardware.html:37 templates/static/hardware.html:124 #: templates/static/hardware.html:242 templates/modules/news-preview.html:6 +#: templates/modules/planet-entry.html:13 templates/planet/posting.html:13 +#: templates/planet/hottest.html:14 msgid "by" msgstr "" @@ -2721,7 +2723,7 @@ msgid "Please use the support forums to get help with your IPFire system." msgstr "" #: templates/static/imprint.html:40 templates/static/imprint.html:60 -#: templates/static/imprint.html:80 templates/planet/user.html:53 +#: templates/static/imprint.html:80 msgid "Mail" msgstr "" @@ -2841,14 +2843,6 @@ msgstr "" msgid "Reason for transfer" msgstr "" -#: templates/modules/planet-entry.html:14 templates/planet/posting.html:22 -msgid "Posted by" -msgstr "" - -#: templates/modules/planet-entry.html:15 templates/planet/posting.html:23 -msgid "on" -msgstr "" - #: templates/modules/news-item.html:6 msgid "Announcement" msgstr "" @@ -2937,27 +2931,31 @@ msgstr "" msgid "Mirrors" msgstr "" -#: templates/modules/menu.html:123 +#: templates/modules/menu.html:129 msgid "CeBIT" msgstr "" -#: templates/modules/menu.html:129 +#: templates/modules/menu.html:135 msgid "Tracker" msgstr "" -#: templates/modules/menu.html:139 +#: templates/modules/menu.html:145 msgid "Planet" msgstr "" -#: templates/modules/menu.html:142 +#: templates/modules/menu.html:148 msgid "Downloads" msgstr "" -#: templates/modules/menu.html:146 +#: templates/modules/menu.html:152 msgid "Device Vendors" msgstr "" -#: templates/modules/menu.html:187 +#: templates/modules/menu.html:159 templates/planet/hottest.html:3 +msgid "Hottest posts" +msgstr "" + +#: templates/modules/menu.html:197 msgid "Professional support available!" msgstr "" @@ -2997,14 +2995,18 @@ msgstr "" msgid "%s did not write any posts, yet." msgstr "" -#: templates/planet/posting.html:15 +#: templates/planet/posting.html:22 msgid "Heads up!" msgstr "" -#: templates/planet/posting.html:15 +#: templates/planet/posting.html:22 msgid "This post is a draft and has not been published, yet." msgstr "" +#: templates/planet/hottest.html:8 +msgid "The hottest posts of the last month" +msgstr "" + #: templates/planet/base.html:9 msgid "The official blog of the IPFire team" msgstr "" diff --git a/webapp/ui_modules.py b/webapp/ui_modules.py index 454557cf..f61cfca8 100644 --- a/webapp/ui_modules.py +++ b/webapp/ui_modules.py @@ -384,6 +384,42 @@ class DonationBoxModule(UIModule): class DonationButtonModule(UIModule): + # https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/ + COUNTRIES = ( + "AU", + "AT", + "BE", + "BR", + "CA", + "CH", + "CN", + "DE", + "ES", + "GB", + "FR", + "IT", + "NL", + "PL", + "PT", + "RU", + "US", + ) + + LOCALES = ( + "da_DK", + "he_IL", + "id_ID", + "ja_JP", + "no_NO", + "pt_BR", + "ru_RU", + "sv_SE", + "th_TH", + "zh_CN", + "zh_HK", + "zh_TW", + ) + def render(self, reason_for_transfer=None, currency="EUR"): if not reason_for_transfer: reason_for_transfer = "IPFire.org" @@ -391,4 +427,31 @@ class DonationButtonModule(UIModule): primary = (currency == "EUR") return self.render_string("modules/donation-button.html", primary=primary, - reason_for_transfer=reason_for_transfer, currency=currency) + reason_for_transfer=reason_for_transfer, currency=currency, lc=self.lc) + + @property + def lc(self): + """ + Returns the locale of the user + """ + try: + locale, delimiter, encoding = self.locale.code.partition(".") + + # Break for languages in specific countries + if locale in self.LOCALES: + return locale + + lang, delimiter, country_code = locale.partition("_") + print locale, "TEST", country_code + + if country_code and country_code in self.COUNTRIES: + return country_code + + lang = lang.upper() + if lang in self.COUNTRIES: + return lang + except: + pass + + # If anything goes wrong, fall back to GB + return "GB"