diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index 8a05ac615bbe..f9f556619d9b 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -5,6 +5,7 @@ namespace App\Console\Commands; use Carbon; use App\Libraries\CurlUtils; use DB; +use App; use Exception; use Illuminate\Console\Command; use Mail; @@ -81,6 +82,7 @@ class CheckData extends Command } //$this->checkInvoices(); + $this->checkTranslations(); $this->checkInvoiceBalances(); $this->checkClientBalances(); $this->checkContacts(); @@ -115,6 +117,44 @@ class CheckData extends Command $this->log .= $str . "\n"; } + private function checkTranslations() + { + $invalid = 0; + + foreach (cache('languages') as $language) { + App::setLocale($language->locale); + foreach (trans('texts') as $text) { + if ($language->locale != 'en') { + continue; + } + + if (strpos($text, '=') !== false) { + $invalid++; + $this->logMessage($language->locale . ' is invalid: ' . $text); + } + + preg_match('/(.script)/', strtolower($text), $matches); + if (count($matches)) { + foreach ($matches as $match) { + if (in_array($match, ['escript', 'bscript', 'nscript'])) { + continue; + } + $invalid++; + $this->logMessage($language->locale . ' is invalid: ' . $text); + break; + } + } + } + } + + if ($invalid > 0) { + $this->isValid = false; + } + + App::setLocale('en'); + $this->logMessage($invalid . ' invalid languages'); + } + private function checkDraftSentInvoices() { $invoices = Invoice::whereInvoiceStatusId(INVOICE_STATUS_SENT) diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 01594fa5a89b..690c6086c72e 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -403,7 +403,11 @@ class InvoiceController extends BaseController } if (! Auth::user()->confirmed) { - $errorMessage = trans(Auth::user()->registered ? 'texts.confirmation_required' : 'texts.registration_required'); + if (Auth::user()->registered) { + $errorMessage = trans('texts.confirmation_required', ['link' => link_to('/resend_confirmation', trans('texts.click_here'))]); + } else { + $errorMessage = trans('texts.registration_required'); + } Session::flash('error', $errorMessage); return Redirect::to('invoices/'.$invoice->public_id.'/edit'); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index f4f5ac3a29af..384bd48a9186 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -118,7 +118,7 @@ class UserController extends BaseController } if (! Auth::user()->confirmed) { - Session::flash('error', trans('texts.confirmation_required')); + Session::flash('error', trans('texts.confirmation_required', ['link' => link_to('/resend_confirmation', trans('texts.click_here'))])); return Redirect::to('settings/' . ACCOUNT_USER_MANAGEMENT); } diff --git a/app/Http/Middleware/StartupCheck.php b/app/Http/Middleware/StartupCheck.php index 6f96aee3ba3c..71d3d971381c 100644 --- a/app/Http/Middleware/StartupCheck.php +++ b/app/Http/Middleware/StartupCheck.php @@ -218,7 +218,7 @@ class StartupCheck // Show message to IE 8 and before users if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/(?i)msie [2-8]/', $_SERVER['HTTP_USER_AGENT'])) { - Session::flash('error', trans('texts.old_browser', ['link' => OUTDATE_BROWSER_URL])); + Session::flash('error', trans('texts.old_browser', ['link' => link_to(OUTDATE_BROWSER_URL, trans('texts.newer_browser'), ['target' => '_blank'])])); } $response = $next($request); diff --git a/app/Listeners/HandleUserLoggedIn.php b/app/Listeners/HandleUserLoggedIn.php index 9eee5232041c..3fd5380f4e04 100644 --- a/app/Listeners/HandleUserLoggedIn.php +++ b/app/Listeners/HandleUserLoggedIn.php @@ -102,7 +102,7 @@ class HandleUserLoggedIn if (in_array(config('app.key'), ['SomeRandomString', 'SomeRandomStringSomeRandomString', 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'])) { Session::flash('error', trans('texts.error_app_key_set_to_default')); } elseif (in_array($appCipher, ['MCRYPT_RIJNDAEL_256', 'MCRYPT_RIJNDAEL_128'])) { - Session::flash('error', trans('texts.mcrypt_warning')); + Session::flash('error', trans('texts.mcrypt_warning', ['command' => 'php artisan ninja:update-key --legacy=true'])); } } } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 8123734fc845..9edb0c841e8b 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -99,9 +99,9 @@ $LANG = array(

Use :MONTH, :QUARTER or :YEAR for dynamic dates. Basic math works as well, for example :MONTH-1.

Examples of dynamic invoice variables:

', 'in_total_revenue' => 'in total revenue', 'billed_client' => 'billed client', @@ -200,7 +200,7 @@ $LANG = array( 'limit_clients' => 'Sorry, this will exceed the limit of :count clients', 'payment_error' => 'There was an error processing your payment. Please try again later.', 'registration_required' => 'Please sign up to email an invoice', - 'confirmation_required' => 'Please confirm your email address, click here to resend the confirmation email.', + 'confirmation_required' => 'Please confirm your email address, :link to resend the confirmation email.', 'updated_client' => 'Successfully updated client', 'created_client' => 'Successfully created client', 'archived_client' => 'Successfully archived client', @@ -655,8 +655,10 @@ $LANG = array( 'created_by_invoice' => 'Created by :invoice', 'primary_user' => 'Primary User', 'help' => 'Help', - 'customize_help' => '

We use pdfmake to define the invoice designs declaratively. The pdfmake playground provides a great way to see the library in action.

-

If you need help figuring something out post a question to our support forum with the design you\'re using.

', + 'customize_help' => '

We use :pdfmake_link to define the invoice designs declaratively. The pdfmake :playground_link provides a great way to see the library in action.

+

If you need help figuring something out post a question to our :forum_link with the design you\'re using.

', + 'playground' => 'playground', + 'support_forum' => 'support forum', 'invoice_due_date' => 'Due Date', 'quote_due_date' => 'Valid Until', 'valid_until' => 'Valid Until', @@ -1009,9 +1011,11 @@ $LANG = array( 'reset_password_footer' => 'If you did not request this password reset please email our support: :email', 'limit_users' => 'Sorry, this will exceed the limit of :limit users', 'more_designs_self_host_header' => 'Get 6 more invoice designs for just $:price', - 'old_browser' => 'Please use a newer browser', + 'old_browser' => 'Please use a :link', + 'newer_browser' => 'newer browser', 'white_label_custom_css' => ':link for $:price to enable custom styling and help support our project.', - 'bank_accounts_help' => 'Connect a bank account to automatically import expenses and create vendors. Supports American Express and 400+ US banks.', + 'bank_accounts_help' => 'Connect a bank account to automatically import expenses and create vendors. Supports American Express and :link.', + 'us_banks' => '400+ US banks', 'pro_plan_remove_logo' => ':link to remove the Invoice Ninja logo by joining the Pro Plan', 'pro_plan_remove_logo_link' => 'Click here', @@ -1825,7 +1829,7 @@ $LANG = array( 'bot_emailed_notify_paid' => 'I\'ll email you when it\'s paid.', 'add_product_to_invoice' => 'Add 1 :product', 'not_authorized' => 'You are not authorized', - 'bot_get_email' => 'Hi! (wave)
Thanks for trying the Invoice Ninja Bot.
You need to create a free account on invoiceninja.com to use this bot.
Send me your account email address to get started.', + 'bot_get_email' => 'Hi! (wave)
Thanks for trying the Invoice Ninja Bot.
You need to create a free account to use this bot.
Send me your account email address to get started.', 'bot_get_code' => 'Thanks! I\'ve sent a you an email with your security code.', 'bot_welcome' => 'That\'s it, your account is verified.
', 'email_not_found' => 'I wasn\'t able to find an available account for :email', @@ -2400,7 +2404,8 @@ $LANG = array( 'currency_ugandan_shilling' => 'Ugandan Shilling', 'currency_barbadian_dollar' => 'Barbadian Dollar', 'currency_brunei_dollar' => 'Brunei Dollar', - 'review_app_help' => 'We hope you\'re enjoying using the app.
If you\'d consider writing a review we\'d greatly appreciate it!', + 'review_app_help' => 'We hope you\'re enjoying using the app.
If you\'d consider :link we\'d greatly appreciate it!', + 'writing_a_review' => 'writing a review', 'use_english_version' => 'Make sure to use the English version of the files.
We use the column headers to match the fields.', 'tax1' => 'First Tax', @@ -2611,7 +2616,7 @@ $LANG = array( 'unable_to_delete_primary' => 'Note: to delete this company first delete all linked companies.', 'please_register' => 'Please register your account', 'processing_request' => 'Processing request', - 'mcrypt_warning' => 'Warning: Mcrypt is deprecated, run php artisan ninja:update-key --legacy=true to update your cipher.', + 'mcrypt_warning' => 'Warning: Mcrypt is deprecated, run :command to update your cipher.', 'edit_times' => 'Edit Times', 'inclusive_taxes_help' => 'Include taxes in the cost', 'inclusive_taxes_notice' => 'This setting can not be changed once an invoice has been created.', diff --git a/resources/views/accounts/bank_account.blade.php b/resources/views/accounts/bank_account.blade.php index 614dcfa4dc35..e85af8e1af3c 100644 --- a/resources/views/accounts/bank_account.blade.php +++ b/resources/views/accounts/bank_account.blade.php @@ -39,7 +39,7 @@ ->data_bind('combobox: bank_id') ->addOption('', '') ->fromQuery($banks, 'name', 'id') - ->blockHelp(trans('texts.bank_accounts_help', ['link' => OFX_HOME_URL])) !!} + ->blockHelp(trans('texts.bank_accounts_help', ['link' => link_to(OFX_HOME_URL, trans('texts.us_banks'), ['target' => '_blank'])])) !!} @endif
diff --git a/resources/views/accounts/customize_design.blade.php b/resources/views/accounts/customize_design.blade.php index b9d1982cdcf0..5ed387039416 100644 --- a/resources/views/accounts/customize_design.blade.php +++ b/resources/views/accounts/customize_design.blade.php @@ -228,7 +228,11 @@
- {!! trans('texts.customize_help') !!}
+ {!! trans('texts.customize_help', [ + 'pdfmake_link' => link_to('http://pdfmake.org', 'pdfmake', ['target' => '_blank']), + 'playground_link' => link_to('http://pdfmake.org/playground.html', trans('texts.playground'), ['target' => '_blank']), + 'forum_link' => link_to('https://www.invoiceninja.com/forums/forum/support', trans('texts.support_forum'), ['target' => '_blank']), + ]) !!}
@include('partials/variables_help', ['entityType' => ENTITY_INVOICE, 'account' => $account]) diff --git a/resources/views/accounts/management.blade.php b/resources/views/accounts/management.blade.php index 01361ee3f6b7..b01165cfe3ff 100644 --- a/resources/views/accounts/management.blade.php +++ b/resources/views/accounts/management.blade.php @@ -95,7 +95,7 @@ @endif @if (Auth::user()->created_at->diffInMonths() >= 3) - {!! Former::plaintext(' ')->help('review_app_help') !!} + {!! Former::plaintext(' ')->help(trans('texts.review_app_help', ['link' => link_to('http://www.capterra.com/p/145215/Invoice-Ninja', trans('texts.writing_a_review'), ['target' => '_blank'])])) !!} @endif
diff --git a/resources/views/partials/upgrade_modal.blade.php b/resources/views/partials/upgrade_modal.blade.php index ed2a6292e78a..88d6d9aebe76 100644 --- a/resources/views/partials/upgrade_modal.blade.php +++ b/resources/views/partials/upgrade_modal.blade.php @@ -69,7 +69,7 @@ swal("{!! trans('texts.please_register') !!}"); return; @elseif ( ! Auth::check() || ! Auth::user()->confirmed) - swal("{!! trans('texts.confirmation_required') !!}"); + swal("{!! trans('texts.confirmation_required', ['link' => link_to('/resend_confirmation', trans('texts.click_here'))]) !!}"); return; @endif