30 $this->codes = $codes;
41 $dir = rtrim($dir,
'/\\');
43 if (is_dir(
"$dir/languages")) {
49 foreach (scandir($dir) as $entry) {
50 if ($entry[0] ===
'.') {
54 $path =
"$dir/$entry";
56 if (is_dir(
"$path/languages")) {
70 $dir = rtrim($dir,
'/\\');
72 foreach (scandir($dir) as $entry) {
73 if ($entry[0] ===
'.') {
77 if (pathinfo($entry, PATHINFO_EXTENSION) !==
'php') {
81 $path =
"$dir/$entry";
83 $code = basename($entry,
'.php');
84 if (!in_array(
$code, $this->codes)) {
87 if (in_array(
$code, $this->codes)) {
89 rename(
$path,
"$dir/$code.php");
90 $this->log[] =
"Renamed $path to $code.php";
95 $this->log[] =
"Removed $path";
Removes invalid language files from an installation.
static getAllLanguageCodes()
Returns an array of language codes.
cleanInstallation($dir)
Clean up within an installation.
cleanLanguagesDir($dir)
Clean up a languages dir.
__construct(array $codes=[])
Constructor.
static normalizeLanguageCode($code)
Normalize a language code (e.g.