frontend translation + other stuff

This commit is contained in:
lordwilbur
2018-05-18 00:03:30 +02:00
committed by Nabeel Shahzad
parent ba8a819c7d
commit a346b0df2e
54 changed files with 966 additions and 771 deletions

View File

@@ -13,7 +13,7 @@ $factory->define(App\Models\Flight::class, function (Faker $faker) {
},
'flight_number' => $faker->unique()->numberBetween(10, 1000000),
'route_code' => $faker->randomElement(['', $faker->text(5)]),
'route_leg' => $faker->randomElement(['', $faker->text(5)]),
'route_leg' => $faker->randomElement(['', $faker->numberBetween(0, 1000)]),
'dpt_airport_id' => function () {
return factory(App\Models\Airport::class)->create()->id;
},

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeRouteLegToUnsignedInteger extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('flights', function (Blueprint $table) {
$table->unsignedInteger('route_leg')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('flights', function (Blueprint $table) {
//
});
}
}

View File

@@ -481,9 +481,9 @@ class Metar implements \ArrayAccess
$time_diff = floor(($now - $local) / 60);
if ($time_diff < 91) {
$this->set_result_value('observed_age', $time_diff.' '.__trans_choice('min ago', $time_diff));
$this->set_result_value('observed_age', $time_diff.' '.trans_choice('frontend.widgets.weather.minago', $time_diff));
} else {
$this->set_result_value('observed_age', floor($time_diff / 60).':'.sprintf("%02d", $time_diff % 60).' '.__trans_choice('hr ago', floor($time_diff / 60)));
$this->set_result_value('observed_age', floor($time_diff / 60).':'.sprintf("%02d", $time_diff % 60).' '.trans_choice('frontend.widgets.weather.hrago', floor($time_diff / 60)));
}
}

View File

@@ -220,20 +220,4 @@ if (!function_exists('_fmt')) {
return $line;
}
}
if (!function_exists('__trans_choice')) {
/**
* Translates the given message based on a count from json key.
*
* @param $key
* @param $number
* @param array $replace
* @param null $locale
* @return string
*/
function __trans_choice($key, $number, array $replace = [], $locale = null)
{
return trans_choice(__($key), $number, $replace, $locale);
}
}