Language support (partial)

This commit is contained in:
Tobias Herre 2021-07-06 18:36:18 +02:00
parent 8f35208d33
commit 8f8f9b1505
5 changed files with 138 additions and 27 deletions

46
ka.php
View File

@ -1,9 +1,24 @@
<!doctype html> <!doctype html>
<?php <?php
$lang=$_GET['lang']; $lang=$_GET['lang'];
if ( !in_array ($lang, array('en'))){ if ( !in_array ($lang, array('en_US'))){
$lang=""; $locale = $lang;
} }
else
$locale = "de_DE";
$locale = "en_US";
$domain = "messages";
setlocale(LC_MESSAGES, $locale);
setlocale(LC_ALL, $locale);
$results = putenv("LC_ALL=$locale");
$results = bindtextdomain($domain,"./locale");
?> ?>
<html > <html >
<head> <head>
@ -25,36 +40,37 @@
<img alt="wikimedia logo" src="Wikimedia_Deutschland-Logo.svg"/> <img alt="wikimedia logo" src="Wikimedia_Deutschland-Logo.svg"/>
</div> </div>
<div class="main-content"> <div class="main-content">
<?php echo _( " <h1>
<h1>Antrag auf Kostenerstattung</h1> <?php echo _( "Antrag auf Kostenerstattung")?>
<p>Du möchtest dir Kosten erstatten lassen, welche im Rahmen deines </h1>
Projektes entstanden sind?<BR> <p>
Bitte fülle dieses Formular aus. <?php echo _("Du möchtest dir Kosten erstatten lassen, welche im Rahmen deines Projektes entstanden sind?")?><BR>
Pflichtfelder sind mit einem * gekennzeichnet. <?php echo _("Bitte fülle dieses Formular aus. Pflichtfelder sind mit einem * gekennzeichnet.")?>
</p>") ?> </p>
<form data-kube="kaform" name="theform" id="theform" action="submit.php" method="POST"> <form data-kube="kaform" name="theform" id="theform" action="submit.php" method="POST">
<div class="is-row"> <div class="is-row">
<div class="is-col is-70"> <div class="is-col is-70">
<fieldset> <fieldset>
<legend><?php echo _("1. Erfasse deine Stammdaten</legend>")?> <legend><?php echo _("1. Erfasse deine Stammdaten")?></legend>
<div class="is-row"> <div class="is-row">
<div class="is-col"> <div class="is-col">
<input required type="input" <input required type="input"
size="32" id="projectid" name="project" size="32" id="projectid" name="project"
placeholder="Projekt/Zweck der Reise*" /> placeholder="<?php echo _("Projekt/Zweck der Reise*")?>" />
</div> </div>
</div> </div>
<br> <br>
<div class="is-row"> <div class="is-row">
<div class="is-col"> <div class="is-col">
<input required type="input" size="32" <input required type="input" size="32"
` id="realname" name="realname" placeholder="Dein Realname (Vorname Nachname)*" /> ` id="realname" name="realname" placeholder="<?php echo _("Dein Realname (Vorname Nachname)*")?>" />
</div> </div>
<div class="is-col"> <div class="is-col">
<input type="input" size="32" <input type="input" size="32"
` id="wmdecontact" name="wmdecontact" placeholder="Deine Ansprechperson bei Wikimedia" /> ` id="wmdecontact" name="wmdecontact"
placeholder="<?= _("Deine Ansprechperson bei Wikimedia")?>" />
</div> </div>
</div> </div>
<br> <br>
@ -64,7 +80,7 @@
<div class="is-col"> <div class="is-col">
<input type="tel" size="32" <input type="tel" size="32"
id="phone" name="phone" id="phone" name="phone"
placeholder="Deine Telefonnummer" /> placeholder="<?= _("Deine Telefonnummer")?>" />
</div> </div>
<div class="is-col"> <div class="is-col">
</div> </div>
@ -75,7 +91,7 @@
<div class="is-row"> <div class="is-row">
<div class="is-col"> <div class="is-col">
<input required type="email" size="32" id="email" <input required type="email" size="32" id="email"
name="email" placeholder="Deine E-Mail-Adresse*" /> name="email" placeholder="<?= _("Deine E-Mail-Adresse*")?>" />
</div> </div>
<div class="is-col"> <div class="is-col">
</div> </div>

View File

@ -0,0 +1,60 @@
# German translations for apache package.
# Copyright (C) 2021 THE apache'S COPYRIGHT HOLDER
# This file is distributed under the same license as the apache package.
# Charlie & <root@bsd>, 2021.
#
msgid ""
msgstr ""
"Project-Id-Version: apache 24\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-07-06 18:34+0200\n"
"PO-Revision-Date: 2021-07-06 18:21+0200\n"
"Last-Translator: Charlie & <root@bsd>\n"
"Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ka.php:44
msgid "Antrag auf Kostenerstattung"
msgstr "Request for reimbursement"
#: ka.php:47
msgid ""
"Du möchtest dir Kosten erstatten lassen, welche im Rahmen deines Projektes "
"entstanden sind?"
msgstr ""
"You would like to be reimbursed for costs incurred in the course of your "
"project?"
#: ka.php:48
msgid ""
"Bitte fülle dieses Formular aus. Pflichtfelder sind mit einem * "
"gekennzeichnet."
msgstr "Please fill out this form. Mandatory fields are marked with *."
#: ka.php:56
msgid "1. Erfasse deine Stammdaten"
msgstr "1. Enter your master data"
#: ka.php:61
msgid "Projekt/Zweck der Reise*"
msgstr "Project/Purpose of the trip*"
#: ka.php:68
msgid "Dein Realname (Vorname Nachname)*"
msgstr "Your real name (first name last name)*"
#: ka.php:73
msgid "Deine Ansprechperson bei Wikimedia"
msgstr "Your contact person at Wikimedia"
#: ka.php:83
msgid "Deine Telefonnummer"
msgstr "Your phone number"
#: ka.php:94
msgid "Deine E-Mail-Adresse*"
msgstr "Your email address*"

Binary file not shown.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-06-22 10:09+0200\n" "POT-Creation-Date: 2021-07-06 18:34+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,17 +17,42 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: ka.php:28 #: ka.php:44
msgid "" msgid "Antrag auf Kostenerstattung"
"\n"
"\t\t<h1>Antrag auf Kostenerstattung</h1>\n"
"\t\t<p>Du möchtest dir Kosten erstatten lassen, welche im Rahmen deines\n"
"\t\tProjektes entstanden sind?<BR>\n"
"\t\tBitte fülle dieses Formular aus.\n"
"\t\tPflichtfelder sind mit einem * gekennzeichnet.\n"
"\t\t</p>"
msgstr "" msgstr ""
#: ka.php:41 #: ka.php:47
msgid "1. Erfasse deine Stammdaten</legend>" msgid ""
"Du möchtest dir Kosten erstatten lassen, welche im Rahmen deines Projektes "
"entstanden sind?"
msgstr ""
#: ka.php:48
msgid ""
"Bitte fülle dieses Formular aus. Pflichtfelder sind mit einem * "
"gekennzeichnet."
msgstr ""
#: ka.php:56
msgid "1. Erfasse deine Stammdaten"
msgstr ""
#: ka.php:61
msgid "Projekt/Zweck der Reise*"
msgstr ""
#: ka.php:68
msgid "Dein Realname (Vorname Nachname)*"
msgstr ""
#: ka.php:73
msgid "Deine Ansprechperson bei Wikimedia"
msgstr ""
#: ka.php:83
msgid "Deine Telefonnummer"
msgstr ""
#: ka.php:94
msgid "Deine E-Mail-Adresse*"
msgstr "" msgstr ""

10
mkm.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
touch messages.po
xgettext --add-comments --from-code=utf-8 ka.php
msgmerge locale/en_US/LC_MESSAGES/messages.po messages.po > new.po
cp locale/en_US/LC_MESSAGES/messages.po locale/en_US/LC_MESSAGES/messages.po.bak
mv new.po locale/en_US/LC_MESSAGES/messages.po
rm locale/en_US/LC_MESSAGES/messages.mo
msgfmt locale/en_US/LC_MESSAGES/messages.po -o locale/en_US/LC_MESSAGES/messages.mo