1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Adding translation support for languages

- Languages can now be translated via texts.php
This commit is contained in:
Holger Lösken 2016-07-04 01:02:38 +02:00
parent 19b443d641
commit a114f60127
8 changed files with 44 additions and 5 deletions

View File

@ -393,7 +393,6 @@ class AccountController extends BaseController
'dateFormats' => Cache::get('dateFormats'),
'datetimeFormats' => Cache::get('datetimeFormats'),
'currencies' => Cache::get('currencies'),
'languages' => Cache::get('languages'),
'title' => trans('texts.localization'),
];

View File

@ -206,7 +206,6 @@ class ClientController extends BaseController
'sizes' => Cache::get('sizes'),
'paymentTerms' => Cache::get('paymentTerms'),
'currencies' => Cache::get('currencies'),
'languages' => Cache::get('languages'),
'customLabel1' => Auth::user()->account->custom_client_label1,
'customLabel2' => Auth::user()->account->custom_client_label2,
];

View File

@ -369,7 +369,6 @@ class InvoiceController extends BaseController
'taxRateOptions' => $options,
'defaultTax' => $defaultTax,
'currencies' => Cache::get('currencies'),
'languages' => Cache::get('languages'),
'sizes' => Cache::get('sizes'),
'paymentTerms' => Cache::get('paymentTerms'),
'invoiceDesigns' => InvoiceDesign::getDesigns(),

View File

@ -39,5 +39,10 @@ class TranslationComposer
return $pType->name;
}));
$view->with('languages', Cache::get('languages')->each(function ($lang) {
$lang->name = trans('texts.lang_'.$lang->name);
})->sortBy(function ($lang) {
return $lang->name;
}));
}
}

View File

@ -14,7 +14,7 @@ class ComposerServiceProvider extends ServiceProvider
public function boot()
{
view()->composer(
['accounts.details', 'clients.edit', 'payments.edit', 'invoices.edit'],
['accounts.details', 'clients.edit', 'payments.edit', 'invoices.edit', 'accounts.localization'],
'App\Http\ViewComposers\TranslationComposer'
);
}

View File

@ -1674,6 +1674,24 @@ $LANG = array(
'country_Yemen' => '',
'country_Zambi' => '',
// Languages
'lang_Brazilian Portuguese' => 'Brazilian Portuguese',
'lang_Croatian' => 'Kroatisch',
'lang_Czech' => 'Tschechisch',
'lang_Danish' => 'Dänisch',
'lang_Dutch' => 'Niederländisch',
'lang_English' => 'Englisch',
'lang_French' => 'Französisch',
'lang_French - Canada' => 'French - Canada',
'lang_German' => 'Deutsch',
'lang_Italian' => 'Italian',
'lang_Japanese' => 'Japanese',
'lang_Lithuanian' => 'Lithuanian',
'lang_Norwegian' => 'Norwegian',
'lang_Polish' => 'Polish',
'lang_Spanish' => 'Spanish',
'lang_Spanish - Spain' => 'Spanish - Spain',
'lang_Swedish' => 'Swedish',
);
return $LANG;

View File

@ -1674,6 +1674,25 @@ $LANG = array(
'country_Yemen' => 'Yemen',
'country_Zambi' => 'Zambi',
// Languages
'lang_Brazilian Portuguese' => 'Brazilian Portuguese',
'lang_Croatian' => 'Croatian',
'lang_Czech' => 'Czech',
'lang_Danish' => 'Danish',
'lang_Dutch' => 'Dutch',
'lang_English' => 'English',
'lang_French' => 'French',
'lang_French - Canada' => 'French - Canada',
'lang_German' => 'German',
'lang_Italian' => 'Italian',
'lang_Japanese' => 'Japanese',
'lang_Lithuanian' => 'Lithuanian',
'lang_Norwegian' => 'Norwegian',
'lang_Polish' => 'Polish',
'lang_Spanish' => 'Spanish',
'lang_Spanish - Spain' => 'Spanish - Spain',
'lang_Swedish' => 'Swedish',
// Frequencies
'freq_weekly' => 'Weekly',
'freq_two_weeks' => 'Two weeks',

View File

@ -122,7 +122,7 @@
->placeholder($account->currency ? $account->currency->name : '')
->fromQuery($currencies, 'name', 'id') !!}
{!! Former::select('language_id')->addOption('','')
->placeholder($account->language ? $account->language->name : '')
->placeholder($account->language ? trans('texts.lang_'.$account->language->name) : '')
->fromQuery($languages, 'name', 'id') !!}
{!! Former::select('payment_terms')->addOption('','')
->fromQuery($paymentTerms, 'name', 'num_days')