Merge pull request #1213 from PrivateBin/en-lang-selection
ensure English is always added to available languages, fixes #1208
This commit is contained in:
commit
3b17dfc6ef
3 changed files with 16 additions and 5 deletions
|
@ -1,5 +1,8 @@
|
||||||
# PrivateBin version history
|
# PrivateBin version history
|
||||||
|
|
||||||
|
## 1.6.2 (not yet released)
|
||||||
|
* FIXED: English not selectable when languageselection enabled (#1208)
|
||||||
|
|
||||||
## 1.6.1 (2023-12-04)
|
## 1.6.1 (2023-12-04)
|
||||||
* ADDED: Right-To-Left (RTL) support for Arabic & Hebrew (#1174)
|
* ADDED: Right-To-Left (RTL) support for Arabic & Hebrew (#1174)
|
||||||
* CHANGED: Upgrading libraries to: DOMpurify 3.0.6
|
* CHANGED: Upgrading libraries to: DOMpurify 3.0.6
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
namespace PrivateBin\Data;
|
namespace PrivateBin\Data;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use GlobIterator;
|
||||||
use PrivateBin\Json;
|
use PrivateBin\Json;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -394,7 +395,7 @@ class Filesystem extends AbstractData
|
||||||
public function getAllPastes()
|
public function getAllPastes()
|
||||||
{
|
{
|
||||||
$pastes = array();
|
$pastes = array();
|
||||||
foreach (new \GlobIterator($this->_path . self::PASTE_FILE_PATTERN) as $file) {
|
foreach (new GlobIterator($this->_path . self::PASTE_FILE_PATTERN) as $file) {
|
||||||
if ($file->isFile()) {
|
if ($file->isFile()) {
|
||||||
$pastes[] = $file->getBasename('.php');
|
$pastes[] = $file->getBasename('.php');
|
||||||
}
|
}
|
||||||
|
|
15
lib/I18n.php
15
lib/I18n.php
|
@ -12,6 +12,9 @@
|
||||||
|
|
||||||
namespace PrivateBin;
|
namespace PrivateBin;
|
||||||
|
|
||||||
|
use AppendIterator;
|
||||||
|
use GlobIterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* I18n
|
* I18n
|
||||||
*
|
*
|
||||||
|
@ -193,10 +196,14 @@ class I18n
|
||||||
public static function getAvailableLanguages()
|
public static function getAvailableLanguages()
|
||||||
{
|
{
|
||||||
if (count(self::$_availableLanguages) == 0) {
|
if (count(self::$_availableLanguages) == 0) {
|
||||||
$i18n = dir(self::_getPath());
|
self::$_availableLanguages[] = 'en'; // en.json is not part of the release archive
|
||||||
while (false !== ($file = $i18n->read())) {
|
$languageIterator = new AppendIterator();
|
||||||
if (preg_match('/^([a-z]{2,3}).json$/', $file, $match) === 1) {
|
$languageIterator->append(new GlobIterator(self::_getPath('??.json')));
|
||||||
self::$_availableLanguages[] = $match[1];
|
$languageIterator->append(new GlobIterator(self::_getPath('???.json'))); // for jbo
|
||||||
|
foreach ($languageIterator as $file) {
|
||||||
|
$language = $file->getBasename('.json');
|
||||||
|
if ($language != 'en') {
|
||||||
|
self::$_availableLanguages[] = $language;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue