rootSlug = $rootSlug; $this->packageDir = $packageDir; } /** * Put your language overrides here! * * @param string $locale * @return string */ protected function override($locale) { switch ($locale) { // Put your overrides here! case 'de_AT': case 'de_CH': case 'de_CH_informal': case 'de_DE_formal': return 'de_DE'; break; default: break; } return $locale; } /** * Get the directory where the languages folder exists. * * @param string $type * @return string[] */ protected function getPackageInfo($type) { $textdomain = $this->getRootSlug() . '-' . $this->getPackage(); if ($type === Localization::$PACKAGE_INFO_BACKEND) { return [path_join($this->getPackageDir(), 'languages/backend'), $textdomain, $this->getPackage()]; } else { return [path_join($this->getPackageDir(), 'languages/frontend/json'), $textdomain, $this->getPackage()]; } } /** * Getter. * * @return string * @codeCoverageIgnore */ public function getRootSlug() { return $this->rootSlug; } /** * Get package name. * * @return string */ public function getPackage() { return basename($this->getPackageDir()); } /** * Getter. * * @return string * @codeCoverageIgnore */ public function getPackageDir() { return $this->packageDir; } /** * New instance. * * @param string $rootSlug * @param string $packageDir * @return PackageLocalization * @codeCoverageIgnore Instance getter */ public static function instance($rootSlug, $packageDir) { return new PackageLocalization($rootSlug, $packageDir); } }