Lines Matching defs:lang
27 * @param string|null $lang
31 public static function formatDateString(string $date, string $format = DateTag::DEFAULT_FORMAT, string $lang = null): string
36 if ($lang === null) {
38 $lang = Lang::createFromRequestedMarkup()->getValueOrDefault();
42 $lang = Site::getLang();
47 if ($lang !== null && trim($lang) !== "") {
49 // The lang just works fine but the second argument can be seen in the doc
50 if (strlen(trim($lang)) === 2) {
51 $derivedLocale = strtolower($lang) . $localeSeparator . strtoupper($lang);
53 $derivedLocale = $lang;
55 $newLocale = setlocale(LC_TIME, $lang, $derivedLocale);
57 $newLocale = setlocale(LC_TIME, $lang);
66 // throw new ExceptionBadSyntax("The language ($lang) / locale ($derivedLocale) is not available as locale on the server. You can't then format the value ($date) in this language.");
74 if ($lang === null) {
75 $lang = "";
77 throw new ExceptionBadSyntax("Unable to format the date ($date) with the format ($format) and lang ($lang)");
99 $lang = $tagAttributes->getComponentAttributeValue(Lang::PROPERTY_NAME);
111 return DateTag::formatDateString($date, $format, $lang);