Compare commits
5 commits
Author | SHA1 | Date | |
---|---|---|---|
80ee070168 | |||
70490efb44 | |||
40649c5eeb | |||
39f4ad3b77 | |||
27a4363372 |
3 changed files with 102 additions and 22 deletions
|
@ -2,7 +2,13 @@
|
|||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
|
||||
* German localization (PR [#25](https://code.antopie.org/miraty/libreqr/pulls/25))
|
||||
|
||||
## 2.0.1 - 2023-07-08
|
||||
|
||||
|
|
74
index.php
74
index.php
|
@ -27,7 +27,39 @@ if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
|||
}
|
||||
}
|
||||
}
|
||||
require "locales/" . $locale . ".php";
|
||||
|
||||
require "locales/" . $locale . ".php";
|
||||
$chosen_loc = $loc;
|
||||
|
||||
if ($locale != DEFAULT_LOCALE) {
|
||||
require "locales/" . DEFAULT_LOCALE . ".php";
|
||||
$default_loc = $loc;
|
||||
} else
|
||||
$default_loc = $chosen_loc;
|
||||
|
||||
require "locales/template.php";
|
||||
$template_loc = $loc;
|
||||
|
||||
// Function to get a specific string from the locale file, fall back on default then template if missing
|
||||
function getIntlString(
|
||||
$string_label,
|
||||
$raw = false
|
||||
) {
|
||||
global $chosen_loc, $default_loc, $template_loc, $locale;
|
||||
|
||||
if (array_key_exists($string_label, $chosen_loc))
|
||||
return $chosen_loc[$string_label];
|
||||
|
||||
if ($locale != DEFAULT_LOCALE AND array_key_exists($string_label, $default_loc)) {
|
||||
if ($raw)
|
||||
return $default_loc[$string_label];
|
||||
return "<span lang=\"" . DEFAULT_LOCALE . "\">" . $default_loc[$string_label] . "</span>";
|
||||
}
|
||||
|
||||
if ($raw)
|
||||
return $template_loc[$string_label];
|
||||
return "<span lang=\"en\">" . $template_loc[$string_label] . "</span>";
|
||||
}
|
||||
|
||||
$params = array(
|
||||
"txt" => "",
|
||||
|
@ -147,8 +179,8 @@ if (
|
|||
<html lang="<?= $locale ?>">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>LibreQR · <?= $loc['subtitle'] ?></title>
|
||||
<meta name="description" content="<?= $loc['description'] ?>">
|
||||
<title>LibreQR · <?= getIntlString('subtitle') ?></title>
|
||||
<meta name="description" content="<?= getIntlString('description', raw: true) ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="color-scheme" content="dark light">
|
||||
<meta name="application-name" content="LibreQR">
|
||||
|
@ -174,7 +206,7 @@ foreach($themeDimensionsIcons as $dimFav) // Set all icons dimensions
|
|||
<a id="linkTitles" href="./">
|
||||
<div id="titles">
|
||||
<h1>LibreQR</h1>
|
||||
<h2><?= $loc['subtitle'] ?></h2>
|
||||
<h2><?= getIntlString('subtitle') ?></h2>
|
||||
</div>
|
||||
</a>
|
||||
</header>
|
||||
|
@ -183,21 +215,21 @@ foreach($themeDimensionsIcons as $dimFav) // Set all icons dimensions
|
|||
|
||||
<div class="param" id="txtParam">
|
||||
<details>
|
||||
<summary><label for="txt"><?= $loc['label_content'] ?></label></summary>
|
||||
<summary><label for="txt"><?= getIntlString('label_content') ?></label></summary>
|
||||
<div class="helpText">
|
||||
<?= $loc['help_content'] ?>
|
||||
<?= getIntlString('help_content') ?>
|
||||
</div>
|
||||
</details>
|
||||
<textarea rows="3" required="" id="txt" placeholder="<?= $loc['placeholder'] ?>" name="txt"><?= htmlspecialchars($params['txt']) ?></textarea>
|
||||
<textarea rows="3" required="" id="txt" placeholder="<?= getIntlString('placeholder', raw: true) ?>" name="txt"><?= htmlspecialchars($params['txt']) ?></textarea>
|
||||
</div>
|
||||
|
||||
<div id="sideParams">
|
||||
|
||||
<div class="param">
|
||||
<details>
|
||||
<summary><label for="redundancy"><?= $loc['label_redundancy'] ?></label></summary>
|
||||
<summary><label for="redundancy"><?= getIntlString('label_redundancy') ?></label></summary>
|
||||
<p class="helpText">
|
||||
<?= $loc['help_redundancy'] ?>
|
||||
<?= getIntlString('help_redundancy') ?>
|
||||
</p>
|
||||
</details>
|
||||
<select id="redundancy" name="redundancy">
|
||||
|
@ -210,9 +242,9 @@ foreach($themeDimensionsIcons as $dimFav) // Set all icons dimensions
|
|||
|
||||
<div class="param">
|
||||
<details>
|
||||
<summary><label for="margin"><?= $loc['label_margin'] ?></label></summary>
|
||||
<summary><label for="margin"><?= getIntlString('label_margin') ?></label></summary>
|
||||
<p class="helpText">
|
||||
<?= $loc['help_margin'] ?>
|
||||
<?= getIntlString('help_margin') ?>
|
||||
</p>
|
||||
</details>
|
||||
<input type="number" id="margin" placeholder="<?= DEFAULT_MARGIN ?>" name="margin" required="" min="0" max="1024" value="<?= htmlspecialchars($params['margin']) ?>">
|
||||
|
@ -220,9 +252,9 @@ foreach($themeDimensionsIcons as $dimFav) // Set all icons dimensions
|
|||
|
||||
<div class="param">
|
||||
<details>
|
||||
<summary><label for="size"><?= $loc['label_size'] ?></label></summary>
|
||||
<summary><label for="size"><?= getIntlString('label_size') ?></label></summary>
|
||||
<p class="helpText">
|
||||
<?= $loc['help_size'] ?>
|
||||
<?= getIntlString('help_size') ?>
|
||||
</p>
|
||||
</details>
|
||||
<input type="number" id="size" placeholder="<?= DEFAULT_SIZE ?>" name="size" required="" min="21" max="4096" value="<?= htmlspecialchars($params['size']) ?>">
|
||||
|
@ -232,17 +264,17 @@ foreach($themeDimensionsIcons as $dimFav) // Set all icons dimensions
|
|||
|
||||
<div id="colors">
|
||||
<div class="param">
|
||||
<label for="bgColor"><?= $loc['label_bgColor'] ?></label>
|
||||
<label for="bgColor"><?= getIntlString('label_bgColor') ?></label>
|
||||
<input type="color" name="bgColor" id="bgColor" value="#<?= htmlspecialchars($params['bgColor']) ?>">
|
||||
</div>
|
||||
<div class="param">
|
||||
<label for="fgColor"><?= $loc['label_fgColor'] ?></label>
|
||||
<label for="fgColor"><?= getIntlString('label_fgColor') ?></label>
|
||||
<input type="color" name="fgColor" id="fgColor" value="#<?= htmlspecialchars($params['fgColor']) ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="centered">
|
||||
<input class="button" type="submit" value="<?= $loc['button_create'] ?>" />
|
||||
<input class="button" type="submit" value="<?= getIntlString('button_create', raw: true) ?>" />
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
@ -258,11 +290,11 @@ if ($qrCodeAvailable) {
|
|||
|
||||
<section id="output">
|
||||
<div class="centered" id="downloadQR">
|
||||
<a href="<?= $dataUri ?>" class="button" download="<?= htmlspecialchars($params['txt']); ?>.png"><?= $loc['button_download'] ?></a>
|
||||
<a href="<?= $dataUri ?>" class="button" download="<?= htmlspecialchars($params['txt']); ?>.png"><?= getIntlString('button_download') ?></a>
|
||||
</div>
|
||||
|
||||
<div class="centered" id="showOnlyQR">
|
||||
<a title="<?= $loc['title_showOnlyQR'] ?>" href="<?= $dataUri ?>"><img width="<?= $qrSize ?>" height="<?= $qrSize ?>" alt='<?= $loc['alt_QR_before'] ?><?= htmlspecialchars($params['txt']); ?><?= $loc['alt_QR_after'] ?>' id="qrCode"<?php
|
||||
<a title="<?= getIntlString('title_showOnlyQR', raw: true) ?>" href="<?= $dataUri ?>"><img width="<?= $qrSize ?>" height="<?= $qrSize ?>" alt='<?= getIntlString('alt_QR_before', raw: true) ?><?= htmlspecialchars($params['txt']); ?><?= getIntlString('alt_QR_after', raw: true) ?>' id="qrCode"<?php
|
||||
|
||||
// Compute the difference between the QR code and theme background colors
|
||||
$diffLight = abs($rgbBgColor['r']-hexdec(substr($colorScheme['bg-light'],-6,2))) + abs($rgbBgColor['g']-hexdec(substr($colorScheme['bg-light'],-4,2))) + abs($rgbBgColor['b']-hexdec(substr($colorScheme['bg-light'],-2,2)));
|
||||
|
@ -280,14 +312,14 @@ if ($qrCodeAvailable) {
|
|||
|
||||
<?php
|
||||
} else if ($qrCodeAvailable === false) {
|
||||
echo " <p><strong>" . $loc['error_generation'] . "</strong></p></body></html>";
|
||||
echo " <p><strong>" . getIntlString('error_generation') . "</strong></p></body></html>";
|
||||
}
|
||||
?>
|
||||
|
||||
<footer>
|
||||
|
||||
<section id="info" class="metaText">
|
||||
<?= $loc['metaText_qr'] ?>
|
||||
<?= getIntlString('metaText_qr') ?>
|
||||
</section>
|
||||
|
||||
<?php if (CUSTOM_TEXT_ENABLED) { ?>
|
||||
|
@ -297,7 +329,7 @@ if ($qrCodeAvailable) {
|
|||
<?php } ?>
|
||||
|
||||
<section class="metaText">
|
||||
<small><?= $loc['metaText_legal'] ?></small>
|
||||
<small><?= getIntlString('metaText_legal') ?></small>
|
||||
</section>
|
||||
|
||||
</footer>
|
||||
|
|
42
locales/de.php
Normal file
42
locales/de.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php // This file is part of LibreQR, which is distributed under the GNU AGPLv3+ license
|
||||
$loc = array(
|
||||
'subtitle' => "QR-Code-Generator",
|
||||
'description' => "Erstellen Sie QR-Codes kostenlos. Wählen Sie Inhalt, Größe, Farben…",
|
||||
|
||||
'label_content' => "Text zum Kodieren",
|
||||
'label_redundancy' => "Redundanzgrad",
|
||||
'label_margin' => "Randgröße",
|
||||
'label_size' => "Bildgröße",
|
||||
'label_bgColor' => "Hintergrundfarbe",
|
||||
'label_fgColor' => "Vordergrundfarbe",
|
||||
|
||||
'placeholder' => "Geben Sie den Text ein, den Sie im QR-Code kodieren möchten",
|
||||
|
||||
'help_content' => "
|
||||
<p>Sie können jeden Text kodieren, den Sie möchten.</p>
|
||||
<p>Software, die diese QR-Codes dekodiert, kann je nach <a href='https://de.wikipedia.org/wiki/Uniform_Resource_Identifier#Schema' hreflang='de' rel='help external noreferrer'>URI-Schema</a> vorschlagen, sie mit spezieller Software zu öffnen.</p>
|
||||
<p>Beispielsweise, um eine Webseite zu öffnen: <code>https://www.example/</code></p>
|
||||
<p>Um eine E-Mail zu senden: <code>mailto:contact@email.example</code></p>
|
||||
<p>Um geografische Koordinaten zu teilen: <code>geo:48.867564,2.364057</code></p>
|
||||
",
|
||||
'help_redundancy' => "Redundanz ist die Duplizierung von Informationen im QR-Code, um Fehler während der Dekodierung zu korrigieren. Ein höherer Grad produziert einen größeren QR-Code, aber hat eine bessere Chance, korrekt dekodiert zu werden.",
|
||||
'help_margin' => "Breite des Randes um den QR-Code in Pixel.",
|
||||
'help_size' => "Bildbreite und -höhe in Pixel, ohne den Rand.",
|
||||
|
||||
'button_create' => "Erstellen",
|
||||
'button_download' => "Diesen QR-Code speichern",
|
||||
|
||||
'title_showOnlyQR' => "Nur diesen QR-Code anzeigen",
|
||||
|
||||
'alt_QR_before' => 'QR-Code mit der Bedeutung "',
|
||||
'alt_QR_after' => '"',
|
||||
|
||||
'metaText_qr' => "
|
||||
<h3>Was ist ein QR-Code?</h3>
|
||||
Ein QR-Code ist ein zweidimensionaler Barcode, in dem Text in Binärcode geschrieben ist. Er kann mit einem Gerät mit Fotosensor und geeigneter Software dekodiert werden.
|
||||
<a href='https://de.wikipedia.org/wiki/QR-Code' hreflang='de' rel='help external noreferrer'>QR-Code auf Wikipedia</a>.
|
||||
",
|
||||
'metaText_legal' => "LibreQR " . LIBREQR_VERSION . " ist Freie Software, deren <a href='https://code.antopie.org/miraty/libreqr/' rel='external noreferrer'>Quellcode</a> unter den Bedingungen der <abbr title='GNU Affero General Public License Version 3 oder einer späteren Version'><a href='LICENSE.html' hreflang='en' rel='license'>AGPLv3</a>+</abbr> verfügbar ist.",
|
||||
|
||||
'error_generation' => "Ein Fehler ist aufgetreten, während der QR-Code generiert wurde. Versuchen Sie es mit anderen Parametern.",
|
||||
);
|
Loading…
Add table
Reference in a new issue