aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/translation-checker.php5
-rw-r--r--lib/private/L10N/L10NString.php6
2 files changed, 11 insertions, 0 deletions
diff --git a/build/translation-checker.php b/build/translation-checker.php
index 1f7ec343af5..2c3a7856d81 100644
--- a/build/translation-checker.php
+++ b/build/translation-checker.php
@@ -48,6 +48,11 @@ foreach ($directories as $dir) {
$content = file_get_contents($file->getPathname());
$json = json_decode($content, true);
+ $translations = json_encode($json['translations']);
+ if (strpos($content, '|') !== false) {
+ $errors[] = $file->getPathname() . "\n" . ' ' . 'Contains a | in the translations' . "\n";
+ }
+
if (json_last_error() !== JSON_ERROR_NONE) {
$errors[] = $file->getPathname() . "\n" . ' ' . json_last_error_msg() . "\n";
} else {
diff --git a/lib/private/L10N/L10NString.php b/lib/private/L10N/L10NString.php
index 0eadadf9be1..ae90f52a02d 100644
--- a/lib/private/L10N/L10NString.php
+++ b/lib/private/L10N/L10NString.php
@@ -59,6 +59,12 @@ class L10NString implements \JsonSerializable {
public function __toString(): string {
$translations = $this->l10n->getTranslations();
+
+ $pipeCheck = implode('', $translations[$this->text]);
+ if (strpos($pipeCheck, '|') !== false) {
+ return 'Can not use pipe character in translations';
+ }
+
$identityTranslator = $this->l10n->getIdentityTranslator();
$parameters = $this->parameters;