1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2024-11-24 19:33:07 +01:00

Translate

This commit is contained in:
FreeScout 2018-11-24 08:48:06 -08:00
parent aaabffb9aa
commit 42eff0f61b
11 changed files with 809 additions and 166 deletions

View File

@ -49,7 +49,8 @@
"RachidLaasri\\LaravelInstaller\\Controllers\\": "overrides/RachidLaasri/LaravelInstaller/Controllers/",
"Nwidart\\Modules\\": "overrides/Nwidart/Modules/",
"Codedge\\Updater\\SourceRepositoryTypes\\": "overrides/Codedge/Updater/SourceRepositoryTypes/",
"Illuminate\\Foundation\\": "overrides/Illuminate/Foundation/"
"Illuminate\\Foundation\\": "overrides/Illuminate/Foundation/",
"Barryvdh\\TranslationManager\\": "overrides/Barryvdh/TranslationManager/"
},
"exclude-from-classmap": [
"vendor/axn/laravel-laroute/src/Routes/Collection.php",
@ -66,7 +67,8 @@
"vendor/nwidart/laravel-modules/src/Repository.php",
"vendor/nwidart/laravel-modules/src/Json.php",
"vendor/codedge/laravel-selfupdater/src/SourceRepositoryTypes/GithubRepositoryType.php",
"vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php"
"vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php",
"vendor/barryvdh/laravel-translation-manager/src/Manager.php"
]
},
"autoload-dev": {

View File

@ -40,8 +40,21 @@ return [
* 'validation',
* )
*/
'exclude_groups' => [],
'exclude_groups' => [
'auth',
'reminders',
'pagination',
'passwords',
'validation',
'installer_messages',
],
/**
* Regular expression may determine goup incorrectly, for example for 'e.g'
*/
'incorrect_groups' => [
'e',
],
/*
* Exclude specific languages from Laravel Translation Manager.
*

View File

@ -0,0 +1,456 @@
<?php
namespace Barryvdh\TranslationManager;
use Barryvdh\TranslationManager\Events\TranslationsExportedEvent;
use Barryvdh\TranslationManager\Models\Translation;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
class Manager
{
const JSON_GROUP = '_json';
/** @var \Illuminate\Contracts\Foundation\Application */
protected $app;
/** @var \Illuminate\Filesystem\Filesystem */
protected $files;
/** @var \Illuminate\Contracts\Events\Dispatcher */
protected $events;
protected $config;
protected $locales;
protected $ignoreLocales;
protected $ignoreFilePath;
public function __construct( Application $app, Filesystem $files, Dispatcher $events )
{
$this->app = $app;
$this->files = $files;
$this->events = $events;
$this->config = $app[ 'config' ][ 'translation-manager' ];
$this->ignoreFilePath = storage_path( '.ignore_locales' );
$this->locales = [];
$this->ignoreLocales = $this->getIgnoredLocales();
}
protected function getIgnoredLocales()
{
if ( !$this->files->exists( $this->ignoreFilePath ) ) {
return [];
}
$result = json_decode( $this->files->get( $this->ignoreFilePath ) );
return ( $result && is_array( $result ) ) ? $result : [];
}
public function importTranslations( $replace = false, $base = null )
{
$counter = 0;
//allows for vendor lang files to be properly recorded through recursion.
$vendor = true;
if ( $base == null ) {
$base = $this->app[ 'path.lang' ];
$vendor = false;
}
foreach ( $this->files->directories( $base ) as $langPath ) {
$locale = basename( $langPath );
//import langfiles for each vendor
if ( $locale == 'vendor' ) {
foreach ( $this->files->directories( $langPath ) as $vendor ) {
$counter += $this->importTranslations( $replace, $vendor );
}
continue;
}
$vendorName = $this->files->name( $this->files->dirname( $langPath ) );
foreach ( $this->files->allfiles( $langPath ) as $file ) {
$info = pathinfo( $file );
$group = $info[ 'filename' ];
if ( in_array( $group, $this->config[ 'exclude_groups' ] ) ) {
continue;
}
$subLangPath = str_replace( $langPath . DIRECTORY_SEPARATOR, '', $info[ 'dirname' ] );
$subLangPath = str_replace( DIRECTORY_SEPARATOR, '/', $subLangPath );
$langPath = str_replace( DIRECTORY_SEPARATOR, '/', $langPath );
if ( $subLangPath != $langPath ) {
$group = $subLangPath . '/' . $group;
}
if ( !$vendor ) {
$translations = \Lang::getLoader()->load( $locale, $group );
} else {
$translations = include( $file );
$group = "vendor/" . $vendorName;
}
if ( $translations && is_array( $translations ) ) {
foreach ( array_dot( $translations ) as $key => $value ) {
$importedTranslation = $this->importTranslation( $key, $value, $locale, $group, $replace );
$counter += $importedTranslation ? 1 : 0;
}
}
}
}
foreach ( $this->files->files( $this->app[ 'path.lang' ] ) as $jsonTranslationFile ) {
if ( strpos( $jsonTranslationFile, '.json' ) === false ) {
continue;
}
$locale = basename( $jsonTranslationFile, '.json' );
$group = self::JSON_GROUP;
$translations =
\Lang::getLoader()->load( $locale, '*', '*' ); // Retrieves JSON entries of the given locale only
if ( $translations && is_array( $translations ) ) {
foreach ( $translations as $key => $value ) {
$importedTranslation = $this->importTranslation( $key, $value, $locale, $group, $replace );
$counter += $importedTranslation ? 1 : 0;
}
}
}
return $counter;
}
public function importTranslation( $key, $value, $locale, $group, $replace = false )
{
// process only string values
if ( is_array( $value ) ) {
return false;
}
$value = (string) $value;
$translation = Translation::firstOrNew( [
'locale' => $locale,
'group' => $group,
'key' => $key,
] );
// Check if the database is different then the files
$newStatus = $translation->value === $value ? Translation::STATUS_SAVED : Translation::STATUS_CHANGED;
if ( $newStatus !== (int) $translation->status ) {
$translation->status = $newStatus;
}
// Only replace when empty, or explicitly told so
if ( $replace || !$translation->value ) {
$translation->value = $value;
}
$translation->save();
return true;
}
public function findTranslations( $path = null )
{
$path = $path ?: base_path();
$groupKeys = [];
$stringKeys = [];
$functions = $this->config[ 'trans_functions' ];
$groupPattern = // See http://regexr.com/392hu
"[^\w|>]" . // Must not have an alphanum or _ or > before real method
'(' . implode( '|', $functions ) . ')' . // Must start with one of the functions
"\(" . // Match opening parenthesis
"[\'\"]" . // Match " or '
'(' . // Start a new group to match:
'[a-zA-Z0-9_-]+' . // Must start with group
"([.|\/](?! )[^\1)]+)+" . // Be followed by one or more items/keys
')' . // Close group
"[\'\"]" . // Closing quote
"[\),]"; // Close parentheses or new parameter
$stringPattern =
"[^\w|>]" . // Must not have an alphanum or _ or > before real method
'(' . implode( '|', $functions ) . ')' . // Must start with one of the functions
"\(" . // Match opening parenthesis
"(?P<quote>['\"])" . // Match " or ' and store in {quote}
"(?P<string>(?:\\\k{quote}|(?!\k{quote}).)*)" . // Match any string that can be {quote} escaped
"\k{quote}" . // Match " or ' previously matched
"[\),]"; // Close parentheses or new parameter
// Find all PHP + Twig files in the app folder, except for storage
$finder = new Finder();
$searchInModules = false;
if (!empty(request()->submit) && request()->submit == 'modules') {
// Find in modules.
$searchInModules = true;
$finder->in( $path.DIRECTORY_SEPARATOR.'Modules' )->name( '*.php' )->name( '*.twig' )->name( '*.vue' )->files();
} else {
// Find in core.
$finder->in( $path )->exclude( 'Modules' )->name( '*.php' )->name( '*.twig' )->name( '*.vue' )->files();
}
/** @var \Symfony\Component\Finder\SplFileInfo $file */
foreach ( $finder as $file ) {
// Search the current file for the pattern
if ( preg_match_all( "/$groupPattern/siU", $file->getContents(), $matches ) ) {
// Get all matches
foreach ( $matches[ 2 ] as $key ) {
$group = explode('.', $key)[0];
if (!in_array($group, $this->config[ 'incorrect_groups'])) {
$groupKeys[] = $key;
}
}
}
if ( preg_match_all( "/$stringPattern/siU", $file->getContents(), $matches ) ) {
$moduleAlias = '';
preg_match("/Modules\/([^\/]+)\//", $file->getPathname(), $m);
if (!empty($m[1])) {
$moduleAlias = strtolower($m[1]);
}
foreach ( $matches[ 'string' ] as $key ) {
if ( preg_match( "/(^[a-zA-Z0-9_-]+([.][^\1)\ ]+)+$)/siU", $key, $groupMatches ) ) {
// group{.group}.key format, already in $groupKeys but also matched here
// do nothing, it has to be treated as a group
continue;
}
//TODO: This can probably be done in the regex, but I couldn't do it.
//skip keys which contain namespacing characters, unless they also contain a
//space, which makes it JSON.
if ( !( str_contains( $key, '::' ) && str_contains( $key, '.' ) )
|| str_contains( $key, ' ' ) ) {
// Modules
if ($searchInModules) {
if ($moduleAlias) {
$groupKeys[] = $moduleAlias.'.'.$key;
} else {
continue;
}
} else {
$stringKeys[] = $key;
}
}
}
}
}
// Remove duplicates
$groupKeys = array_unique( $groupKeys );
$stringKeys = array_unique( $stringKeys );
// Add the translations to the database, if not existing.
foreach ( $groupKeys as $key ) {
// Split the group and item
list( $group, $item ) = explode( '.', $key, 2 );
$this->missingKey( '', $group, $item );
}
foreach ( $stringKeys as $key ) {
$group = self::JSON_GROUP;
$item = $key;
$this->missingKey( '', $group, $item );
}
// Return the number of found translations
return count( $groupKeys + $stringKeys );
}
public function missingKey( $namespace, $group, $key )
{
if ( !in_array( $group, $this->config[ 'exclude_groups' ] ) ) {
Translation::firstOrCreate( [
'locale' => $this->app[ 'config' ][ 'app.locale' ],
'group' => $group,
'key' => $key,
] );
}
}
public function exportTranslations( $group = null, $json = false )
{
$basePath = $this->app[ 'path.lang' ];
if ( !is_null( $group ) && !$json ) {
if ( !in_array( $group, $this->config[ 'exclude_groups' ] ) ) {
$vendor = false;
if ( $group == '*' ) {
return $this->exportAllTranslations();
} else {
if ( starts_with( $group, "vendor" ) ) {
$vendor = true;
}
}
$tree = $this->makeTree( Translation::ofTranslatedGroup( $group )
->orderByGroupKeys( array_get( $this->config, 'sort_keys', false ) )
->get() );
foreach ( $tree as $locale => $groups ) {
if ( isset( $groups[ $group ] ) ) {
$translations = $groups[ $group ];
$path = $this->app[ 'path.lang' ];
$locale_path = $locale . DIRECTORY_SEPARATOR . $group;
if ( $vendor ) {
$path = $basePath . '/' . $group . '/' . $locale;
$locale_path = str_after( $group, "/" );
}
$subfolders = explode( DIRECTORY_SEPARATOR, $locale_path );
array_pop( $subfolders );
$subfolder_level = '';
foreach ( $subfolders as $subfolder ) {
$subfolder_level = $subfolder_level . $subfolder . DIRECTORY_SEPARATOR;
$temp_path = rtrim( $path . DIRECTORY_SEPARATOR . $subfolder_level, DIRECTORY_SEPARATOR );
if ( !is_dir( $temp_path ) ) {
mkdir( $temp_path, 0777, true );
}
}
$path = $path . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . $group . '.php';
$output = "<?php\n\nreturn " . var_export( $translations, true ) . ";" . \PHP_EOL;
$this->files->put( $path, $output );
}
}
Translation::ofTranslatedGroup( $group )->update( [ 'status' => Translation::STATUS_SAVED ] );
}
}
if ( $json ) {
$tree = $this->makeTree( Translation::ofTranslatedGroup( self::JSON_GROUP )
->orderByGroupKeys( array_get( $this->config, 'sort_keys', false ) )
->get(), true );
foreach ( $tree as $locale => $groups ) {
if ( isset( $groups[ self::JSON_GROUP ] ) ) {
$translations = $groups[ self::JSON_GROUP ];
$path = $this->app[ 'path.lang' ] . '/' . $locale . '.json';
$output = json_encode( $translations, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_UNICODE );
$this->files->put( $path, $output );
}
}
Translation::ofTranslatedGroup( self::JSON_GROUP )->update( [ 'status' => Translation::STATUS_SAVED ] );
}
$this->events->dispatch( new TranslationsExportedEvent() );
}
public function exportAllTranslations()
{
$groups = Translation::whereNotNull( 'value' )->selectDistinctGroup()->get( 'group' );
foreach ( $groups as $group ) {
if ( $group->group == self::JSON_GROUP ) {
$this->exportTranslations( null, true );
} else {
$this->exportTranslations( $group->group );
}
}
$this->events->dispatch( new TranslationsExportedEvent() );
}
protected function makeTree( $translations, $json = false )
{
$array = [];
foreach ( $translations as $translation ) {
if ( $json ) {
$this->jsonSet( $array[ $translation->locale ][ $translation->group ], $translation->key,
$translation->value );
} else {
array_set( $array[ $translation->locale ][ $translation->group ], $translation->key,
$translation->value );
}
}
return $array;
}
public function jsonSet( &$array, $key, $value )
{
if ( is_null( $key ) ) {
return $array = $value;
}
$array[ $key ] = $value;
return $array;
}
public function cleanTranslations()
{
Translation::whereNull( 'value' )->delete();
}
public function truncateTranslations()
{
Translation::truncate();
}
public function getLocales()
{
if ( empty( $this->locales ) ) {
$locales = array_merge( [ config( 'app.locale' ) ],
Translation::groupBy( 'locale' )->pluck( 'locale' )->toArray() );
foreach ( $this->files->directories( $this->app->langPath() ) as $localeDir ) {
if ( ( $name = $this->files->name( $localeDir ) ) != 'vendor' ) {
$locales[] = $name;
}
}
$this->locales = array_unique( $locales );
sort( $this->locales );
}
return array_diff( $this->locales, $this->ignoreLocales );
}
public function addLocale( $locale )
{
$localeDir = $this->app->langPath() . '/' . $locale;
$this->ignoreLocales = array_diff( $this->ignoreLocales, [ $locale ] );
$this->saveIgnoredLocales();
$this->ignoreLocales = $this->getIgnoredLocales();
if ( !$this->files->exists( $localeDir ) || !$this->files->isDirectory( $localeDir ) ) {
return $this->files->makeDirectory( $localeDir );
}
return true;
}
protected function saveIgnoredLocales()
{
return $this->files->put( $this->ignoreFilePath, json_encode( $this->ignoreLocales ) );
}
public function removeLocale( $locale )
{
if ( !$locale ) {
return false;
}
$this->ignoreLocales = array_merge( $this->ignoreLocales, [ $locale ] );
$this->saveIgnoredLocales();
$this->ignoreLocales = $this->getIgnoredLocales();
Translation::where( 'locale', $locale )->delete();
}
public function getConfig( $key = null )
{
if ( $key == null ) {
return $this->config;
} else {
return $this->config[ $key ];
}
}
}

View File

@ -1,19 +1,6 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];
return array (
'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
);

View File

@ -1,22 +1,9 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
'password' => 'Passwords must be at least six characters and match the confirmation.',
'reset' => 'Your password has been reset!',
'sent' => 'We have e-mailed your password reset link!',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that e-mail address.",
];
return array (
'password' => 'Passwords must be at least six characters and match the confirmation.',
'reset' => 'Your password has been reset!',
'sent' => 'We have e-mailed your password reset link!',
'token' => 'This password reset token is invalid.',
'user' => 'We can\'t find a user with that e-mail address.',
);

View File

@ -1,121 +1,89 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
'accepted' => 'The :attribute must be accepted.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute may only contain letters.',
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
'alpha_num' => 'The :attribute may only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'between' => [
'numeric' => 'The :attribute must be between :min and :max.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'string' => 'The :attribute must be between :min and :max characters.',
'array' => 'The :attribute must have between :min and :max items.',
],
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'date' => 'The :attribute is not a valid date.',
'date_format' => 'The :attribute does not match the format :format.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'email' => 'The :attribute must be a valid email address.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field must have a value.',
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.',
'max' => [
'numeric' => 'The :attribute may not be greater than :max.',
'file' => 'The :attribute may not be greater than :max kilobytes.',
'string' => 'The :attribute may not be greater than :max characters.',
'array' => 'The :attribute may not have more than :max items.',
],
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' => [
'numeric' => 'The :attribute must be at least :min.',
'file' => 'The :attribute must be at least :min kilobytes.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute must have at least :min items.',
],
'not_in' => 'The selected :attribute is invalid.',
'numeric' => 'The :attribute must be a number.',
'present' => 'The :attribute field must be present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values is present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'size' => [
'numeric' => 'The :attribute must be :size.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
],
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid zone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'url' => 'The :attribute format is invalid.',
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as E-Mail Address instead
| of "email". This simply helps us make messages a little cleaner.
|
*/
'attributes' => [],
];
return array (
'accepted' => 'The :attribute must be accepted.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute may only contain letters.',
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
'alpha_num' => 'The :attribute may only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'between' =>
array (
'numeric' => 'The :attribute must be between :min and :max.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'string' => 'The :attribute must be between :min and :max characters.',
'array' => 'The :attribute must have between :min and :max items.',
),
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'date' => 'The :attribute is not a valid date.',
'date_format' => 'The :attribute does not match the format :format.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'email' => 'The :attribute must be a valid email address.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field must have a value.',
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.',
'max' =>
array (
'numeric' => 'The :attribute may not be greater than :max.',
'file' => 'The :attribute may not be greater than :max kilobytes.',
'string' => 'The :attribute may not be greater than :max characters.',
'array' => 'The :attribute may not have more than :max items.',
),
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' =>
array (
'numeric' => 'The :attribute must be at least :min.',
'file' => 'The :attribute must be at least :min kilobytes.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute must have at least :min items.',
),
'not_in' => 'The selected :attribute is invalid.',
'numeric' => 'The :attribute must be a number.',
'present' => 'The :attribute field must be present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values is present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'size' =>
array (
'numeric' => 'The :attribute must be :size.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
),
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid zone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'url' => 'The :attribute format is invalid.',
'custom' =>
array (
'attribute-name' =>
array (
'rule-name' => 'custom-message',
),
),
);

View File

@ -0,0 +1,17 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'Ces identifiants ne correspondent pas à nos enregistrements',
'throttle' => 'Tentatives de connexion trop nombreuses. Veuillez essayer de nouveau dans :seconds secondes.',
];

View File

@ -0,0 +1,17 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => '&laquo; Précédent',
'next' => 'Suivant &raquo;',
];

View File

@ -0,0 +1,20 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reminder Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
'password' => 'Les mots de passe doivent contenir au moins six caractères et être identiques.',
'reset' => 'Votre mot de passe a été réinitialisé !',
'sent' => 'Nous vous avons envoyé par email le lien de réinitialisation du mot de passe !',
'token' => "Ce jeton de réinitialisation du mot de passe n'est pas valide.",
'user' => "Aucun utilisateur n'a été trouvé avec cette adresse email.",
];

View File

@ -0,0 +1,175 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages.
|
*/
'accepted' => 'Le champ :attribute doit être accepté.',
'active_url' => "Le champ :attribute n'est pas une URL valide.",
'after' => 'Le champ :attribute doit être une date postérieure au :date.',
'after_or_equal' => 'Le champ :attribute doit être une date postérieure ou égale au :date.',
'alpha' => 'Le champ :attribute doit contenir uniquement des lettres.',
'alpha_dash' => 'Le champ :attribute doit contenir uniquement des lettres, des chiffres et des tirets.',
'alpha_num' => 'Le champ :attribute doit contenir uniquement des chiffres et des lettres.',
'array' => 'Le champ :attribute doit être un tableau.',
'before' => 'Le champ :attribute doit être une date antérieure au :date.',
'before_or_equal' => 'Le champ :attribute doit être une date antérieure ou égale au :date.',
'between' => [
'numeric' => 'La valeur de :attribute doit être comprise entre :min et :max.',
'file' => 'La taille du fichier de :attribute doit être comprise entre :min et :max kilo-octets.',
'string' => 'Le texte :attribute doit contenir entre :min et :max caractères.',
'array' => 'Le tableau :attribute doit contenir entre :min et :max éléments.',
],
'boolean' => 'Le champ :attribute doit être vrai ou faux.',
'confirmed' => 'Le champ de confirmation :attribute ne correspond pas.',
'date' => "Le champ :attribute n'est pas une date valide.",
'date_format' => 'Le champ :attribute ne correspond pas au format :format.',
'different' => 'Les champs :attribute et :other doivent être différents.',
'digits' => 'Le champ :attribute doit contenir :digits chiffres.',
'digits_between' => 'Le champ :attribute doit contenir entre :min et :max chiffres.',
'dimensions' => "La taille de l'image :attribute n'est pas conforme.",
'distinct' => 'Le champ :attribute a une valeur en double.',
'email' => 'Le champ :attribute doit être une adresse email valide.',
'exists' => 'Le champ :attribute sélectionné est invalide.',
'file' => 'Le champ :attribute doit être un fichier.',
'filled' => 'Le champ :attribute doit avoir une valeur.',
'gt' => [
'numeric' => 'La valeur de :attribute doit être supérieure à :value.',
'file' => 'La taille du fichier de :attribute doit être supérieure à :value kilo-octets.',
'string' => 'Le texte :attribute doit contenir plus de :value caractères.',
'array' => 'Le tableau :attribute doit contenir plus de :value éléments.',
],
'gte' => [
'numeric' => 'La valeur de :attribute doit être supérieure ou égale à :value.',
'file' => 'La taille du fichier de :attribute doit être supérieure ou égale à :value kilo-octets.',
'string' => 'Le texte :attribute doit contenir au moins :value caractères.',
'array' => 'Le tableau :attribute doit contenir au moins :value éléments.',
],
'image' => 'Le champ :attribute doit être une image.',
'in' => 'Le champ :attribute est invalide.',
'in_array' => "Le champ :attribute n'existe pas dans :other.",
'integer' => 'Le champ :attribute doit être un entier.',
'ip' => 'Le champ :attribute doit être une adresse IP valide.',
'ipv4' => 'Le champ :attribute doit être une adresse IPv4 valide.',
'ipv6' => 'Le champ :attribute doit être une adresse IPv6 valide.',
'json' => 'Le champ :attribute doit être un document JSON valide.',
'lt' => [
'numeric' => 'La valeur de :attribute doit être inférieure à :value.',
'file' => 'La taille du fichier de :attribute doit être inférieure à :value kilo-octets.',
'string' => 'Le texte :attribute doit contenir moins de :value caractères.',
'array' => 'Le tableau :attribute doit contenir moins de :value éléments.',
],
'lte' => [
'numeric' => 'La valeur de :attribute doit être inférieure ou égale à :value.',
'file' => 'La taille du fichier de :attribute doit être inférieure ou égale à :value kilo-octets.',
'string' => 'Le texte :attribute doit contenir au plus :value caractères.',
'array' => 'Le tableau :attribute doit contenir au plus :value éléments.',
],
'max' => [
'numeric' => 'La valeur de :attribute ne peut être supérieure à :max.',
'file' => 'La taille du fichier de :attribute ne peut pas dépasser :max kilo-octets.',
'string' => 'Le texte de :attribute ne peut contenir plus de :max caractères.',
'array' => 'Le tableau :attribute ne peut contenir plus de :max éléments.',
],
'mimes' => 'Le champ :attribute doit être un fichier de type : :values.',
'mimetypes' => 'Le champ :attribute doit être un fichier de type : :values.',
'min' => [
'numeric' => 'La valeur de :attribute doit être supérieure ou égale à :min.',
'file' => 'La taille du fichier de :attribute doit être supérieure à :min kilo-octets.',
'string' => 'Le texte :attribute doit contenir au moins :min caractères.',
'array' => 'Le tableau :attribute doit contenir au moins :min éléments.',
],
'not_in' => "Le champ :attribute sélectionné n'est pas valide.",
'not_regex' => "Le format du champ :attribute n'est pas valide.",
'numeric' => 'Le champ :attribute doit contenir un nombre.',
'present' => 'Le champ :attribute doit être présent.',
'regex' => 'Le format du champ :attribute est invalide.',
'required' => 'Le champ :attribute est obligatoire.',
'required_if' => 'Le champ :attribute est obligatoire quand la valeur de :other est :value.',
'required_unless' => 'Le champ :attribute est obligatoire sauf si :other est :values.',
'required_with' => 'Le champ :attribute est obligatoire quand :values est présent.',
'required_with_all' => 'Le champ :attribute est obligatoire quand :values sont présents.',
'required_without' => "Le champ :attribute est obligatoire quand :values n'est pas présent.",
'required_without_all' => "Le champ :attribute est requis quand aucun de :values n'est présent.",
'same' => 'Les champs :attribute et :other doivent être identiques.',
'size' => [
'numeric' => 'La valeur de :attribute doit être :size.',
'file' => 'La taille du fichier de :attribute doit être de :size kilo-octets.',
'string' => 'Le texte de :attribute doit contenir :size caractères.',
'array' => 'Le tableau :attribute doit contenir :size éléments.',
],
'string' => 'Le champ :attribute doit être une chaîne de caractères.',
'timezone' => 'Le champ :attribute doit être un fuseau horaire valide.',
'unique' => 'La valeur du champ :attribute est déjà utilisée.',
'uploaded' => "Le fichier du champ :attribute n'a pu être téléversé.",
'url' => "Le format de l'URL de :attribute n'est pas valide.",
'uuid' => 'Le champ :attribute doit être un UUID valide',
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as E-Mail Address instead
| of "email". This simply helps us make messages a little cleaner.
|
*/
'attributes' => [
'name' => 'nom',
'username' => "nom d'utilisateur",
'email' => 'adresse email',
'first_name' => 'prénom',
'last_name' => 'nom',
'password' => 'mot de passe',
'password_confirmation' => 'confirmation du mot de passe',
'city' => 'ville',
'country' => 'pays',
'address' => 'adresse',
'phone' => 'téléphone',
'mobile' => 'portable',
'age' => 'âge',
'sex' => 'sexe',
'gender' => 'genre',
'day' => 'jour',
'month' => 'mois',
'year' => 'année',
'hour' => 'heure',
'minute' => 'minute',
'second' => 'seconde',
'title' => 'titre',
'content' => 'contenu',
'description' => 'description',
'excerpt' => 'extrait',
'date' => 'date',
'time' => 'heure',
'available' => 'disponible',
'size' => 'taille',
],
];

View File

@ -30,16 +30,10 @@
<?php endif; ?>
<p>
<?php if(!isset($group)) : ?>
<form class="form-find" method="POST" action="<?php echo action('\Barryvdh\TranslationManager\Controller@postFind') ?>" data-remote="true" role="form" data-confirm="Search may take some time, please don't reload the page until the search process finishes.<?php /*Are you sure you want to scan you app folder? All found translation keys will be added to the database.*/ ?>">
<div class="form-group">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
1. <button type="submit" class="btn btn-primary" data-disable-with="Searching…" >Find translations in files</button>
</div>
</form>
<form class="form-import" method="POST" action="<?php echo action('\Barryvdh\TranslationManager\Controller@postImport') ?>" data-remote="true" role="form">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
<div class="form-group">
<p>2. Import existing translations (imported by groups).</p>
<p>1. Import existing translations.</p>
<div class="row">
<div class="col-sm-3">
<select name="replace" class="form-control">
@ -53,6 +47,13 @@
</div>
</div>
</form>
<form class="form-find" method="POST" action="<?php echo action('\Barryvdh\TranslationManager\Controller@postFind') ?>" data-remote="true" role="form" data-confirm="Search may take some time, please don't reload the page until the search process finishes.<?php /*Are you sure you want to scan you app folder? All found translation keys will be added to the database.*/ ?>">
<div class="form-group">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
2. <button type="submit" class="btn btn-primary" name="submit" value="modules" data-disable-with="Searching…" >Find translations in modules</button>
<button type="submit" class="btn btn-primary hidden" data-disable-with="Searching…" >Find translations in files</button>
</div>
</form>
<?php endif; ?>
<?php if(isset($group)) : ?>
<form class="form-inline form-publish" method="POST" action="<?php echo action('\Barryvdh\TranslationManager\Controller@postPublish', $group) ?>" data-remote="true" role="form" data-confirm="Are you sure you want to publish the translations group '<?php echo $group ?>? This will overwrite existing language files.">