Merge remote branch 'upstream/master'
This commit is contained in:
@@ -543,6 +543,9 @@ class Language extends BaseLanguage
|
|||||||
throw new Exception( 'The plugin ' . $plugin . ' not exist' );
|
throw new Exception( 'The plugin ' . $plugin . ' not exist' );
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
if (!file_exists(PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . 'translation.php')) {
|
||||||
|
throw new Exception( 'Translation.php not exist in plugin ' . $plugin);
|
||||||
|
}
|
||||||
if (!file_exists(PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $idLanguage . '.po')) {
|
if (!file_exists(PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $idLanguage . '.po')) {
|
||||||
throw new Exception( 'The file ' . $plugin . '.' . $idLanguage . '.po not exists' );
|
throw new Exception( 'The file ' . $plugin . '.' . $idLanguage . '.po not exists' );
|
||||||
die();
|
die();
|
||||||
@@ -656,6 +659,10 @@ class Language extends BaseLanguage
|
|||||||
|
|
||||||
function createLanguagePlugin ($plugin, $idLanguage)
|
function createLanguagePlugin ($plugin, $idLanguage)
|
||||||
{
|
{
|
||||||
|
if (!file_exists(PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . 'translation.php')) {
|
||||||
|
throw new Exception( 'Translation.php not exist in plugin ' . $plugin);
|
||||||
|
}
|
||||||
|
|
||||||
G::LoadSystem( 'i18n_po' );
|
G::LoadSystem( 'i18n_po' );
|
||||||
G::LoadClass( "system" );
|
G::LoadClass( "system" );
|
||||||
|
|
||||||
|
|||||||
@@ -230,6 +230,13 @@ class Translation extends BaseTranslation
|
|||||||
*/
|
*/
|
||||||
public function generateFileTranslationPlugin ($plugin, $languageId = '')
|
public function generateFileTranslationPlugin ($plugin, $languageId = '')
|
||||||
{
|
{
|
||||||
|
if (!file_exists(PATH_PLUGINS . $plugin . 'translations' . PATH_SEP . 'translation.php')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!file_exists(PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $languageId . '.po')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$translation = Array ();
|
$translation = Array ();
|
||||||
$translationJS = Array ();
|
$translationJS = Array ();
|
||||||
|
|
||||||
@@ -244,6 +251,37 @@ class Translation extends BaseTranslation
|
|||||||
foreach ($translations as $key => $row) {
|
foreach ($translations as $key => $row) {
|
||||||
$translation[$key] = $row;
|
$translation[$key] = $row;
|
||||||
}
|
}
|
||||||
|
$languageFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $languageId . '.po' ;
|
||||||
|
G::LoadSystem( 'i18n_po' );
|
||||||
|
$POFile = new i18n_PO( $languageFile );
|
||||||
|
$POFile->readInit();
|
||||||
|
while ($rowTranslation = $POFile->getTranslation()) {
|
||||||
|
foreach ($POFile->translatorComments as $a => $aux) {
|
||||||
|
$aux = trim( $aux );
|
||||||
|
if ($aux == 'TRANSLATION') {
|
||||||
|
$identifier = $aux;
|
||||||
|
} else {
|
||||||
|
$var = explode( '/', $aux );
|
||||||
|
if ($var[0] == 'LABEL') {
|
||||||
|
$context = $aux;
|
||||||
|
}
|
||||||
|
if ($var[0] == 'JAVASCRIPT') {
|
||||||
|
$context = $aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (preg_match( '/^([\w-]+)\/([\w-]+\/*[\w-]*\.xml\?)/', $aux, $match )) {
|
||||||
|
$identifier = $aux;
|
||||||
|
} else {
|
||||||
|
if (preg_match( '/^([\w-]+)\/([\w-]+\/*[\w-]*\.xml$)/', $aux, $match )) {
|
||||||
|
$context = $aux;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($identifier == 'TRANSLATION') {
|
||||||
|
list ($category, $id) = explode( '/', $context );
|
||||||
|
$translation[$id] = $rowTranslation['msgstr'] ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (! is_dir( dirname( $cacheFile ) )) {
|
if (! is_dir( dirname( $cacheFile ) )) {
|
||||||
|
|||||||
Reference in New Issue
Block a user