summaryrefslogtreecommitdiffstats
path: root/vendor/ipl/stdlib/src/Contract/Translator.php
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:30:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:30:08 +0000
commit4ce65d59ca91871cfd126497158200a818720bce (patch)
treee277def01fc7eba7dbc21c4a4ae5576e8aa2cf1f /vendor/ipl/stdlib/src/Contract/Translator.php
parentInitial commit. (diff)
downloadicinga-php-library-4ce65d59ca91871cfd126497158200a818720bce.tar.xz
icinga-php-library-4ce65d59ca91871cfd126497158200a818720bce.zip
Adding upstream version 0.13.1.upstream/0.13.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/ipl/stdlib/src/Contract/Translator.php')
-rw-r--r--vendor/ipl/stdlib/src/Contract/Translator.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/vendor/ipl/stdlib/src/Contract/Translator.php b/vendor/ipl/stdlib/src/Contract/Translator.php
new file mode 100644
index 0000000..85ab515
--- /dev/null
+++ b/vendor/ipl/stdlib/src/Contract/Translator.php
@@ -0,0 +1,65 @@
+<?php
+
+namespace ipl\Stdlib\Contract;
+
+/**
+ * Representation of translators
+ */
+interface Translator
+{
+ /**
+ * Translate a message
+ *
+ * @param string $message
+ * @param string $context Message context
+ *
+ * @return string Translated message or original message if no translation is found
+ */
+ public function translate($message, $context = null);
+
+ /**
+ * Translate a message in the given domain
+ *
+ * If no translation is found in the specified domain, the translation is also searched for in the default domain.
+ *
+ * @param string $domain
+ * @param string $message
+ * @param string $context Message context
+ *
+ * @return string Translated message or original message if no translation is found
+ */
+ public function translateInDomain($domain, $message, $context = null);
+
+ /**
+ * Translate a plural message
+ *
+ * The returned message is based on the given number to decide between the singular and plural forms.
+ * That is also the case if no translation is found.
+ *
+ * @param string $singular Singular message
+ * @param string $plural Plural message
+ * @param int $number Number to decide between the returned singular and plural forms
+ * @param string $context Message context
+ *
+ * @return string Translated message or original message if no translation is found
+ */
+ public function translatePlural($singular, $plural, $number, $context = null);
+
+ /**
+ * Translate a plural message in the given domain
+ *
+ * If no translation is found in the specified domain, the translation is also searched for in the default domain.
+ *
+ * The returned message is based on the given number to decide between the singular and plural forms.
+ * That is also the case if no translation is found.
+ *
+ * @param string $domain
+ * @param string $singular Singular message
+ * @param string $plural Plural message
+ * @param int $number Number to decide between the returned singular and plural forms
+ * @param string $context Message context
+ *
+ * @return string Translated message or original message if no translation is found
+ */
+ public function translatePluralInDomain($domain, $singular, $plural, $number, $context = null);
+}