1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00
invoiceninja/app/Utils/TranslationHelper.php
David Bomba 0d508d67f1
Client Settings (#2711)
* Fixes for travis

* Additional settings variables at the company and client level

* Implement accessor for client settings

* Currency symbol or code setter

* Implement custom JS number and currency formatter

* Implement VueX state management for client settings

* Move settings logic into its own class

* Working on client settings

* client settings

* Move Client Settings helper into PHP

* Move translation helper into its own class

* Working on Client Settings

* fixes for client settings

* Client setting defaults

* fixes for .env

* Fixes for Travis
2019-03-03 08:44:08 +11:00

64 lines
1.7 KiB
PHP

<?php
namespace App\Utils;
use App\Models\PaymentTerm;
use Cache;
use Illuminate\Support\Str;
class TranslationHelper
{
public static function getIndustries()
{
return Cache::get('industries')->each(function ($industry) {
$industry->name = ctrans('texts.industry_'.$industry->name);
})->sortBy(function ($industry) {
return $industry->name;
});
}
public static function getCountries()
{
return Cache::get('countries')->each(function ($country) {
$country->name = ctrans('texts.country_'.$country->name);
})->sortBy(function ($country) {
return $country->name;
});
}
public static function getPaymentTypes()
{
return Cache::get('paymentTypes')->each(function ($pType) {
$pType->name = ctrans('texts.payment_type_'.$pType->name);
})->sortBy(function ($pType) {
return $pType->name;
});
}
public static function getLanguages()
{
return Cache::get('languages')->each(function ($lang) {
$lang->name = ctrans('texts.lang_'.$lang->name);
})->sortBy(function ($lang) {
return $lang->name;
});
}
public static function getCurrencies()
{
return Cache::get('currencies')->each(function ($currency) {
$currency->name = ctrans('texts.currency_' . Str::slug($currency->name, '_'));
})->sortBy(function ($currency) {
return $currency->name;
});
}
public static function getPaymentTerms()
{
return PaymentTerm::getCompanyTerms()->map(function ($term){
$term['name'] = ctrans('texts.payment_terms_net') . ' ' . $term['num_days'];
return $term;
});
}
}