Finish translations-updates

issue #262

Gettext and translation cleanup

merge admin.po into messages.po
add language selector in admin area
This commit is contained in:
Vaidas Lungis committed 2015-02-26 16:36:08 +02:00
commit f5ffbf750a
11 files changed
+5207 -9822

No files matched your search

+3
View File
@@ -2,6 +2,9 @@ Release 4.16
------------------------------------------------------------------------------
* Compatibility with MySQL 5.6 Datetime values updated to meet MySQL STRICT_TRANS_TABLES mode rules.
* Fixed add funds issue when admin marked invoice as paid.
* updated translation:
* merged admin.po into messages.po
* added language selector in admin area
Release 4.15 (2015-02-19)
------------------------------------------------------------------------------
+5 -9
View File
@@ -2,15 +2,11 @@
require_once dirname(__FILE__) . '/../src/bb-load.php';
echo "Caching admin templates".PHP_EOL;
echo "Caching templates".PHP_EOL;
$dirs = glob(BB_PATH_MODS.'/*/html_admin');
$dirs[] = BB_PATH_THEMES . '/admin_default/html';
genCache($dirs, "/tmp/bb_admin_cache/");
echo "Caching client templates".PHP_EOL;
$dirs = glob(BB_PATH_MODS.'/*/html_client');
$dirs[] = BB_PATH_THEMES . '/huraga/html';
genCache($dirs, "/tmp/bb_client_cache/");
$dirs = array_merge($dirs, glob(BB_PATH_MODS . '/*/html_client'));
$dirs = array_merge($dirs, glob(BB_PATH_THEMES . '/*/html'));
genCache($dirs, "/tmp/bb-translations/");
function genCache($dirs, $tmpDir)
{
@@ -22,7 +18,7 @@ function genCache($dirs, $tmpDir)
));
$twig->addExtension(new Twig_Extensions_Extension_I18n());
$twig->addExtension(new Twig_Extensions_Extension_Debug());
$twig->addExtension(new Twig_Extensions_Extension_BB());
$twig->addExtension(new Box_TwigExtensions());
foreach($dirs as $tplDir) {
if(is_link(pathinfo($tplDir, PATHINFO_DIRNAME))) {
+11 -18
View File
@@ -1,30 +1,23 @@
# Generate pot files
#!/bin/sh
# Generate pot file
BASEDIR=$(dirname $0)
APPDIR=`cd $BASEDIR/.. ; pwd`
BB_CACHE_ADMIN="/tmp/bb_admin_cache/"
BB_CACHE_CLIENT="/tmp/bb_client_cache/"
BB_POT_ADMIN=$APPDIR/src/bb-locale/admin.pot
BB_POT_CLIENT=$APPDIR/src/bb-locale/messages.pot
BB_CACHE="/tmp/bb-translations/"
BB_POT=$APPDIR/src/bb-locale/messages.pot
BB_POT_EXCLUDE=$APPDIR/bin/gettext_exclude.po
BB_POT_INCLUDE=$APPDIR/bin/gettext_include.pot
rm -rf $BB_CACHE_ADMIN
rm -rf $BB_CACHE_CLIENT
rm -rf $BB_CACHE
php gettext.php
echo "Generating admin.pot file from" $BB_CACHE_ADMIN
cd $BB_CACHE_ADMIN
find . -iname "*.php" | xargs xgettext --omit-header --output=$BB_POT_ADMIN --from-code=UTF-8 --no-location --language=PHP
echo "Generating messages.pot from template files"
cd $BB_CACHE
find . -iname "*.php" | xargs xgettext --omit-header --output=$BB_POT --join-existing --from-code=UTF-8 --no-location --language=PHP --keyword=gettext -x $BB_POT_EXCLUDE
echo "Generating messages.pot file from" $BB_CACHE_CLIENT
cd $BB_CACHE_CLIENT
find . -iname "*.php" | xargs xgettext --omit-header --output=$BB_POT_CLIENT --from-code=UTF-8 --no-location --language=PHP
echo "Joining messages.pot file from" $APPDIR/src
echo "Generating messages.pot from php files"
cd $APPDIR/src
find . -iname "*.php" | xargs xgettext --omit-header --output=$BB_POT_CLIENT --join-existing --from-code=UTF-8 --no-location --language=PHP --keyword=__ --keyword=Box_Exception -x $BB_POT_EXCLUDE
find . -iname '*.php' -not -path './bb-vendor/*' | xargs xgettext --omit-header --output=$BB_POT --join-existing --from-code=UTF-8 --no-location --language=PHP --keyword=__ --keyword=Box_Exception --keyword=Payment_Exception --keyword=gettext -x $BB_POT_EXCLUDE
echo "Joining gettext_include.pot file to messages.pot"
msgcat $BB_POT_INCLUDE $BB_POT_CLIENT --output=$BB_POT_CLIENT
msgcat $BB_POT_INCLUDE $BB_POT --output=$BB_POT
+15 -17
View File
@@ -256,29 +256,27 @@ class WebToPay {
*/
public static function throwResponseError($code) {
$errors = array(
'0x1' => self::_('mokėjimo suma per maža'),
'0x2' => self::_('mokėjimo suma per didelė'),
'0x3' => self::_('nurodyta valiuta neaptarnaujama'),
'0x4' => self::_('nėra sumos arba valiutos'),
'0x6' => self::_('klaidos kodas nebenaudojamas'),
'0x7' => self::_('išjungtas testavimo režimas'),
'0x8' => self::_('jūs uždraudėte šį mokėjimo būdą'),
'0x9' => self::_('blogas "paytext" kintamojo kodavimas (turi būti utf-8)'),
'0x10' => self::_('tuščias arba neteisingai užpildytas "orderid"'),
'0x11' => self::_('mokėjimas negalimas, kol projektas nepatvirtintas arba jeigu jis yra blokuotas'),
'0x12' => self::_('negautas "projectid" parametras, nors jis yra privalomas'),
'0x13' => self::_('"accepturl", "cancellurl" arba "callbacurl" skiriasi nuo projekte patvirtintų adresų'),
'0x14' => self::_('blogai sugeneruotas paraštas ("sign" parametras)'),
'0x15' => self::_('klaidingi kai kurie iš perduotų parametrų'),
'0x15x0' => self::_('neteisingas vienas iš šių parametrų: cancelurl, accepturl, callbackurl'),
'0x15x1' => self::_('neteisingas parametras: time_limit'),
'0x1' => self::_('Payment amount is too small.'),
'0x2' => self::_('Payment amount is too big.'),
'0x3' => self::_('Selected currency is not available.'),
'0x4' => self::_('Amount or currency is missing.'),
'0x6' => self::_('projectId is missing or such ID does not exist.'),
'0x7' => self::_('Testing mode is turned off, but you have still tried to make a test payment.'),
'0x8' => self::_('You have banned this way of payment.'),
'0x9' => self::_('Coding of variable "paytext" is not suitable (has to be utf-8).'),
'0x10' => self::_('Empty or not correctly filled "orderID".'),
'0x11' => self::_('Project has not been checked by our administrator.'),
'0x13' => self::_('Accepturl, cancellurl, callbacurl or referer base address differs from the addresses confirmed in the project.'),
'0x14' => self::_('Invalid "sign" parameter.'),
'0x15x0' => self::_('At least one of these parameters is incorrect: cancelurl, accepturl, callbackurl.'),
'0x15x1' => self::_('Parameter time_limit is not valid (wrong format or not valid value)'),
);
if (isset($errors[$code])) {
$msg = $errors[$code];
}
else {
$msg = self::_('Nenumatyta klaida');
$msg = self::_('Unknown error');
}
throw new WebToPayException($msg);
File diff suppressed because it is too large. Load diff
Binary file not shown.
File diff suppressed because it is too large. Load diff
+5134 -3391
View File
File diff suppressed because it is too large. Load diff
@@ -34,7 +34,19 @@
<div id="topNav">
<div class="fixed">
<div class="wrapper">
<div class="welcome"><a href="{{ 'staff/profile'|alink }}" title=""><img src="{{ profile.email|gravatar }}?size=20" alt="{{ profile.name }}" /></a><span>{% trans 'Hi,' %} {{ profile.name }}!</span></div>
<div class="welcome">
<a href="{{ 'staff/profile'|alink }}" title=""><img src="{{ profile.email|gravatar }}?size=20" alt="{{ profile.name }}" /></a><span>{% trans 'Hi,' %} {{ profile.name }}!</span>
{% set languages = guest.extension_languages %}
{% if languages|length > 1 %}
<span>
<select name="lang" class="language_selector" style="background-color: #262b2f; color:white;">
{% for lang in languages %}
<option value="{{ lang }}" class="lang_{{ lang }}">{{ lang|trans }}</option>
{% endfor %}
</select>
</span>
{% endif %}
</div>
<div class="userNav">
<ul>
<li class="loading" style="display:none;"><img src="images/loader.gif" alt="" /><span>{% trans 'Loading ...' %}</span></li>
@@ -136,6 +136,25 @@ var bb = {
});
matches.parents('li').addClass('active');
},
cookieCreate: function (name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
},
cookieRead: function (name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
},
insertToTextarea: function(areaId, text){
var txtarea = document.getElementById(areaId);
var scrollPos = txtarea.scrollTop;
@@ -272,4 +291,10 @@ $(function() {
$(".hideit").click(function() {
$(this).fadeOut(400);
});
$("select.language_selector").bind('change', function(){
bb.cookieCreate('BBLANG', $(this).val(), 7);
bb.reload();
return false;
}).val(bb.cookieRead('BBLANG'));
});
+1 -3
View File
@@ -18,13 +18,11 @@ if (strncasecmp($url,$admin_prefix, strlen($admin_prefix)) === 0) {
$url = str_replace($admin_prefix, '', preg_replace('/\?.+/', '', $url));
$app = new Box_AppAdmin();
$app->setUrl($url);
$di['translate']('admin');
} else {
$app = new Box_AppClient();
$app->setUrl($url);
$di['translate']();
}
$di['translate']();
$app->setDi($di);
print $app->run();
exit(); // disable auto_append_file directive