Merge pull request #1464 from marcoAntonioNina/master

Improvement plunis translation create and merge of translation.
This commit is contained in:
julceslauhub
2013-03-26 12:54:05 -07:00

View File

@@ -666,17 +666,29 @@ class Language extends BaseLanguage
G::LoadSystem( 'i18n_po' );
G::LoadClass( "system" );
//creating the .po file
$sPOFile = PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $idLanguage . '.po';
$poFile = new i18n_PO( $sPOFile );
$poFile->buildInit();
$language = new Language();
$locale = $language;
$targetLang = $idLanguage;
$baseLang = 'en';
$aLabels = array ();
$aMsgids = array ('' => true
);
include PATH_PLUGINS . $plugin . PATH_SEP . 'translations'. PATH_SEP . 'translations.php';
$translatedText = array();
if (file_exists( PATH_LANGUAGECONT . $plugin . "." . $idLanguage)) {
//reading the .po file
include PATH_LANGUAGECONT . $plugin . "." . $idLanguage;
eval('$translatedText = $translation'.$plugin.';');
}
//creating the .po file
$sPOFile = PATH_PLUGINS . $plugin . PATH_SEP . 'translations' . PATH_SEP . $plugin . '.' . $idLanguage . '.po';
$poFile = new i18n_PO( $sPOFile );
$poFile->buildInit();
//setting headers
$poFile->addHeader( 'Project-Id-Version', $plugin );
$poFile->addHeader( 'POT-Creation-Date', '' );
@@ -690,14 +702,16 @@ class Language extends BaseLanguage
$poFile->addHeader( 'X-Poedit-SourceCharset', 'utf-8' );
$poFile->addHeader( 'Content-Transfer-Encoding', '8bit' );
$aLabels = array ();
$aMsgids = array ('' => true
);
include PATH_PLUGINS . $plugin . PATH_SEP . 'translations'. PATH_SEP . 'translations.php';
foreach ($translations as $id => $translation) {
$msgid = trim( $translation);
$msgstr = trim( $translation );
foreach ($translatedText as $key => $value) {
if ($id == $key) {
$msgstr = trim( $value );
break;
}
}
$poFile->addTranslatorComment( 'TRANSLATION' );
$poFile->addTranslatorComment( 'LABEL/' . $id );
$poFile->addReference( 'LABEL/'. $id );