+
+ /**
+ * Translate days and months names.
+ *
+ * @param string $s String with day or month name.
+ *
+ * @return string Translated string.
+ */
+ public function getDay($s)
+ {
+ $ret = str_replace(['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
+ [$this->t('Monday'), $this->t('Tuesday'), $this->t('Wednesday'), $this->t('Thursday'), $this->t('Friday'), $this->t('Saturday'), $this->t('Sunday')],
+ $s);
+
+ $ret = str_replace(['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ [$this->t('January'), $this->t('February'), $this->t('March'), $this->t('April'), $this->t('May'), $this->t('June'), $this->t('July'), $this->t('August'), $this->t('September'), $this->t('October'), $this->t('November'), $this->t('December')],
+ $ret);
+
+ return $ret;
+ }
+
+ /**
+ * Translate short days and months names.
+ *
+ * @param string $s String with short day or month name.
+ *
+ * @return string Translated string.
+ */
+ public function getDayShort($s)
+ {
+ $ret = str_replace(['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
+ [$this->t('Mon'), $this->t('Tue'), $this->t('Wed'), $this->t('Thu'), $this->t('Fri'), $this->t('Sat'), $this->t('Sun')],
+ $s);
+
+ $ret = str_replace(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+ [$this->t('Jan'), $this->t('Feb'), $this->t('Mar'), $this->t('Apr'), $this->t('May'), $this->t('Jun'), $this->t('Jul'), $this->t('Aug'), $this->t('Sep'), $this->t('Oct'), $this->t('Nov'), $this->t('Dec')],
+ $ret);
+
+ return $ret;
+ }
+
+ /**
+ * Load poke verbs
+ *
+ * @return array index is present tense verb
+ * value is array containing past tense verb, translation of present, translation of past
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ * @hook poke_verbs pokes array
+ */
+ public function getPokeVerbs()
+ {
+ // index is present tense verb
+ // value is array containing past tense verb, translation of present, translation of past
+ $arr = [
+ 'poke' => ['poked', $this->t('poke'), $this->t('poked')],
+ 'ping' => ['pinged', $this->t('ping'), $this->t('pinged')],
+ 'prod' => ['prodded', $this->t('prod'), $this->t('prodded')],
+ 'slap' => ['slapped', $this->t('slap'), $this->t('slapped')],
+ 'finger' => ['fingered', $this->t('finger'), $this->t('fingered')],
+ 'rebuff' => ['rebuffed', $this->t('rebuff'), $this->t('rebuffed')],
+ ];
+
+ Hook::callAll('poke_verbs', $arr);
+
+ return $arr;
+ }
+
+ /**
+ * Creates a new L10n instance based on the given langauge
+ *
+ * @param string $lang The new language
+ *
+ * @return static A new L10n instance
+ * @throws \Exception
+ */
+ public function withLang(string $lang)
+ {
+ // Don't create a new instance for same language
+ if ($lang === $this->lang) {
+ return $this;
+ }
+
+ $newL10n = clone $this;
+ $newL10n->loadTranslationTable($lang);
+ return $newL10n;
+ }