1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Working on multi-language support

This commit is contained in:
Hillel Coren 2014-04-02 21:20:01 +03:00
parent c53528f997
commit 1b7c885367
10 changed files with 102 additions and 46 deletions

View File

@ -26,9 +26,9 @@ class UserController extends BaseController {
$user->force_pdfjs = true;
$user->save();
Session::flash('message', 'Successfully updated PDF settings');
Session::flash('message', trans('texts.confide.updated_settings'));
return Redirect::to('/invoices/create');
return Redirect::to('/dashboard');
}
/**
@ -86,6 +86,7 @@ class UserController extends BaseController {
if( Confide::user() )
{
Event::fire('user.login');
Session::reflash();
$invoice = Invoice::scope()->orderBy('id', 'desc')->first();
@ -95,7 +96,7 @@ class UserController extends BaseController {
}
else
{
return Redirect::to('/invoices/create');
return Redirect::to('/dashboard');
}
}
else
@ -137,7 +138,7 @@ class UserController extends BaseController {
// Check if there was too many login attempts
if( Confide::isThrottled( $input ) )
{
$err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
$err_msg = trans('texts.confide.too_many_attempts');
}
/*
elseif( $user->checkUserExists( $input ) and ! $user->isConfirmed( $input ) )
@ -147,7 +148,7 @@ class UserController extends BaseController {
*/
else
{
$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
$err_msg = trans('texts.confide.wrong_credentials');
}
return Redirect::action('UserController@login')
@ -165,15 +166,13 @@ class UserController extends BaseController {
{
if ( Confide::confirm( $code ) )
{
$notice_msg = Lang::get('confide::confide.alerts.confirmation');
return Redirect::action('UserController@login')
->with( 'notice', $notice_msg );
$notice_msg = trans('texts.confide.confirmation');
return Redirect::action('UserController@login')->with( 'message', $notice_msg );
}
else
{
$error_msg = Lang::get('confide::confide.alerts.wrong_confirmation');
return Redirect::action('UserController@login')
->with( 'error', $error_msg );
$error_msg = trans('texts.confide.wrong_confirmation');
return Redirect::action('UserController@login')->with( 'error', $error_msg );
}
}
@ -194,9 +193,9 @@ class UserController extends BaseController {
{
Confide::forgotPassword( Input::get( 'email' ) );
$notice_msg = Lang::get('confide::confide.alerts.password_forgot');
return Redirect::action('UserController@login')
->with( 'notice', $notice_msg );
$notice_msg = trans('texts.confide.password_forgot');
return Redirect::action('UserController@login')
->with( 'notice', $notice_msg );
/*
@ -241,15 +240,15 @@ class UserController extends BaseController {
// By passing an array with the token, password and confirmation
if( Confide::resetPassword( $input ) )
{
$notice_msg = Lang::get('confide::confide.alerts.password_reset');
return Redirect::action('UserController@login')
->with( 'notice', $notice_msg );
$notice_msg = trans('texts.confide.password_reset');
return Redirect::action('UserController@login')
->with( 'notice', $notice_msg );
}
else
{
$error_msg = Lang::get('confide::confide.alerts.wrong_password_reset');
return Redirect::action('UserController@reset_password', array('token'=>$input['token']))
->withInput()
$error_msg = trans('texts.confide.wrong_password_reset');
return Redirect::action('UserController@reset_password', array('token'=>$input['token']))
->withInput()
->with( 'error', $error_msg );
}
}

View File

@ -277,5 +277,15 @@ return array(
'expiration_year' => 'Expiration year',
'cvv' => 'CVV',
// Security alerts
'confide' => array(
'too_many_attempts' => 'Too many attempts. Try again in few minutes.',
'wrong_credentials' => 'Incorrect email or password.',
'confirmation' => 'Your account has been confirmed!',
'wrong_confirmation' => 'Wrong confirmation code.',
'password_forgot' => 'The information regarding password reset was sent to your email.',
'password_reset' => 'Your password has been changed successfully.',
'wrong_password_reset' => 'Invalid password. Try again',
),
);

View File

@ -277,6 +277,16 @@ return array(
'expiration_year' => 'Expiration year',
'cvv' => 'CVV',
// Security alerts
'confide' => array(
'too_many_attempts' => 'Too many attempts. Try again in few minutes.',
'wrong_credentials' => 'Incorrect email or password.',
'confirmation' => 'Your account has been confirmed!',
'wrong_confirmation' => 'Wrong confirmation code.',
'password_forgot' => 'The information regarding password reset was sent to your email.',
'password_reset' => 'Your password has been changed successfully.',
'wrong_password_reset' => 'Invalid password. Try again',
),
);

View File

@ -275,6 +275,17 @@ return array(
'expiration_month' => 'Expiration month',
'expiration_year' => 'Expiration year',
'cvv' => 'CVV',
// Security alerts
'confide' => array(
'too_many_attempts' => 'Too many attempts. Try again in few minutes.',
'wrong_credentials' => 'Incorrect email or password.',
'confirmation' => 'Your account has been confirmed!',
'wrong_confirmation' => 'Wrong confirmation code.',
'password_forgot' => 'The information regarding password reset was sent to your email.',
'password_reset' => 'Your password has been changed successfully.',
'wrong_password_reset' => 'Invalid password. Try again',
),
);

View File

@ -276,6 +276,17 @@ return array(
'expiration_month' => 'Expiration month',
'expiration_year' => 'Expiration year',
'cvv' => 'CVV',
// Security alerts
'confide' => array(
'too_many_attempts' => 'Too many attempts. Try again in few minutes.',
'wrong_credentials' => 'Incorrect email or password.',
'confirmation' => 'Your account has been confirmed!',
'wrong_confirmation' => 'Wrong confirmation code.',
'password_forgot' => 'The information regarding password reset was sent to your email.',
'password_reset' => 'Your password has been changed successfully.',
'wrong_password_reset' => 'Invalid password. Try again',
),
);

View File

@ -276,6 +276,17 @@ return array(
'expiration_month' => 'Expiration month',
'expiration_year' => 'Expiration year',
'cvv' => 'CVV',
// Security alerts
'confide' => array(
'too_many_attempts' => 'Too many attempts. Try again in few minutes.',
'wrong_credentials' => 'Incorrect email or password.',
'confirmation' => 'Your account has been confirmed!',
'wrong_confirmation' => 'Wrong confirmation code.',
'password_forgot' => 'The information regarding password reset was sent to your email.',
'password_reset' => 'Your password has been changed successfully.',
'wrong_password_reset' => 'Invalid password. Try again',
),

View File

@ -276,5 +276,16 @@ return array(
'expiration_year' => 'Expiration year',
'cvv' => 'CVV',
// Security alerts
'confide' => array(
'too_many_attempts' => 'Too many attempts. Try again in few minutes.',
'wrong_credentials' => 'Incorrect email or password.',
'confirmation' => 'Your account has been confirmed!',
'wrong_confirmation' => 'Wrong confirmation code.',
'password_forgot' => 'The information regarding password reset was sent to your email.',
'password_reset' => 'Your password has been changed successfully.',
'wrong_password_reset' => 'Invalid password. Try again',
),
);

View File

@ -1,9 +1,9 @@
<h1>{{ trans('texts.confirmation_header') }}</h1>
<p>{{ trans('texts.confirmation_message') }}</p>
{{ trans('texts.confirmation_message') }}<p/>
<a href='{{{ URL::to("user/confirm/{$user->confirmation_code}") }}}'>
{{{ URL::to("user/confirm/{$user->confirmation_code}") }}}
</a>
</a><p/>
{{ trans('texts.email_signature') }}<br/>
{{ trans('texts.email_from') }}

View File

@ -172,14 +172,6 @@
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div>
</nav>

View File

@ -470,24 +470,25 @@ function wordWrapText(value, width)
doc.setFontSize(10);
var lines = value.split("\n");
for (var i = 0; i < lines.length; i++) {
var numLines = doc.splitTextToSize(lines[i], width).length;
if (numLines <= 1) continue;
var j = 0; space = lines[i].length;
while (j++ < lines[i].length) {
if (lines[i].charAt(j) === " ") space = j;
}
lines[i + 1] = lines[i].substring(space + 1) + ' ' + (lines[i + 1] || "");
lines[i] = lines[i].substring(0, space);
for (var i = 0; i < lines.length; i++) {
var numLines = doc.splitTextToSize(lines[i], width).length;
if (numLines <= 1) continue;
var j = 0; space = lines[i].length;
while (j++ < lines[i].length) {
if (lines[i].charAt(j) === ' ') space = j;
}
var newValue = (lines.join("\n")).trim();
if (space == lines[i].length) space = width/6;
lines[i + 1] = lines[i].substring(space + 1) + ' ' + (lines[i + 1] || '');
lines[i] = lines[i].substring(0, space);
}
var newValue = (lines.join("\n")).trim();
if (value == newValue) {
return newValue;
} else {
return wordWrapText(newValue, width);
}
if (value == newValue) {
return newValue;
} else {
return wordWrapText(newValue, width);
}
}