3 namespace BookStack\Translation;
7 public function __construct(
8 protected string $appName,
9 protected string $isoName,
15 * Provide the BookStack-specific locale name.
17 public function appLocale(): string
19 return $this->appName;
23 * Provide the ISO-aligned locale name.
25 public function isoLocale(): string
27 return $this->isoName;
31 * Returns a string suitable for the HTML "lang" attribute.
33 public function htmlLang(): string
35 return str_replace('_', '-', $this->isoName);
39 * Returns a string suitable for the HTML "dir" attribute.
41 public function htmlDirection(): string
43 return $this->isRtl ? 'rtl' : 'ltr';
47 * Translate using this locate.
49 public function trans(string $key, array $replace = []): string
51 return trans($key, $replace, $this->appLocale());