Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable localization and publish route #219

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions src/ChatterServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@

namespace DevDojo\Chatter;

use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;

class ChatterServiceProvider extends ServiceProvider
{
/**
* Where publish routes can be written, and will be registered by Chatter.
*
* @var string
*/
public $publishRouteFile = '/routes/chatter/web.php';

/**
* Bootstrap the application services.
*
Expand Down Expand Up @@ -34,8 +42,11 @@ public function boot()
__DIR__.'/Lang' => resource_path('lang/vendor/chatter'),
], 'chatter_lang');

// include the routes file
include __DIR__.'/Routes/web.php';
$this->publishes([
__DIR__.'/Routes' => base_path('routes/chatter'),
], 'chatter_routes');

$this->setupRoutes($this->app->router);
}

/**
Expand All @@ -58,4 +69,19 @@ public function register()

$this->loadViewsFrom(__DIR__.'/Views', 'chatter');
}

/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
public function setupRoutes(Router $router)
{
// if the custom routes file is published, register its routes
if (file_exists(base_path().$this->publishRouteFile)) {
$this->loadRoutesFrom(base_path().$this->publishRouteFile);
}
}
}
37 changes: 37 additions & 0 deletions src/Lang/fr/alert.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

return [
'success' => [
'title' => 'Bravo !!',
'reason' => [
'submitted_to_post' => 'Réponse envoyée avec succès à '.mb_strtolower(trans('chatter::intro.titles.discussion')).'.',
'updated_post' => 'Mis à jour avec succès du '.mb_strtolower(trans('chatter::intro.titles.discussion')).'.',
'destroy_post' => 'Suppression réussie de la réponse et '.mb_strtolower(trans('chatter::intro.titles.discussion')).'.',
'destroy_from_discussion' => 'Suppression réussie de la réponse du '.mb_strtolower(trans('chatter::intro.titles.discussion')).'.',
'created_discussion' => 'Création réussie d\'un nouveau '.mb_strtolower(trans('chatter::intro.titles.discussion')).'.',
],
],
'info' => [
'title' => 'Heads Up!',
],
'warning' => [
'title' => 'Wuh Oh!',
],
'danger' => [
'title' => 'Oh Snap!',
'reason' => [
'errors' => 'Veuillez corriger les éléments suivant errors:',
'prevent_spam' => 'Afin d\'éviter le spam, veuillez prévoir au moins :minutes après la soumission du contenu.',
'trouble' => 'Désolé, il semble y avoir eu un problème lors de la soumission de votre réponse.',
'update_post' => 'Nah ah ah ... Impossible de mettre à jour votre réponse. Assurez-vous de ne rien faire de louche.',
'destroy_post' => 'Nah ah ah ... Impossible de supprimer la réponse. Assurez-vous de ne rien faire de louche.',
'create_discussion' => 'Whoops :( Il semble y avoir un problème à créer votre '.mb_strtolower(trans('chatter::intro.titles.discussion')).'.',
'title_required' => 'Le titre est requis',
'title_min' => 'Le titre doit avoir au moins :min caractères.',
'title_max' => 'Le titre ne doit pas avoir plus de :max caractères.',
'content_required' => 'Le contenu est requis',
'content_min' => 'Le contenu ne doit pas avoir moins de :min caractères',
'category_required' => 'Choisissez une catégorie',
],
],
];
14 changes: 14 additions & 0 deletions src/Lang/fr/email.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

return [
'preheader' => 'Je voulais juste vous faire savoir que quelqu\'un a répondu à un message sur le forum.',
'greeting' => 'Salut,',
'body' => 'Je voulais juste vous faire savoir que quelqu\'un a répondu à un message sur le forum à',
'view_discussion' => 'Voir le '.mb_strtolower(trans('chatter::intro.titles.discussion')).'.',
'farewell' => 'Passez une bonne journée!',
'unsuscribe' => [
'message' => 'Si vous ne souhaitez plus être averti lorsque quelqu\'un répond à ce formulaire, assurez-vous de décocher le paramètre de notification au bas de la page :)',
'action' => 'Vous n\'aimez pas ces emails?',
'link' => 'Se désabonner à cette '.mb_strtolower(trans('chatter::intro.titles.discussion')).'.',
],
];
39 changes: 39 additions & 0 deletions src/Lang/fr/intro.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| Forum Titles
|--------------------------------------------------------------------------
|
| These are some default titles (words) that will be used throughout your
| forum. You can change these to whatever you would like :)
|
*/

'titles' => [
'discussion' => 'Sujet',
'discussions' => 'Sujets',
],

/*
|--------------------------------------------------------------------------
| The main headline and description of your forum
|--------------------------------------------------------------------------
|
| Your headline and your description will be shown on the homepage of your
| forum, unless you change the default theme.
|
| *headline*: This is the main headline on the forum homepage
|
| *description*: This is the main description that will show under the
| headline on the forum homepage.
|
*/

'headline' => 'Forum',
'description' => 'Discutons du code, des bugs et de tout ce qui concerne le développement / design.',

];


44 changes: 44 additions & 0 deletions src/Lang/fr/messages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

return [
'words' => [
'cancel' => 'Annuler',
'delete' => 'Supprimer',
'edit' => 'Modifier',
'yes' => 'Oui',
'no' => 'Non',
'minutes' => '1 minute| :count minutes',
],

'discussion' => [
'new' => 'Nouveau '.trans('chatter::intro.titles.discussion'),
'all' => 'Tous les '.trans('chatter::intro.titles.discussions'),
'create' => 'Créér '.trans('chatter::intro.titles.discussion'),
'posted_by' => 'Par',
'head_details' => 'Posté dans la Catégorie',

],
'response' => [
'confirm' => 'Êtes-vous sûr de vouloir supprimer cette réponse?',
'yes_confirm' => 'Oui le Supprimer',
'no_confirm' => 'Non Merci',
'submit' => 'Envoyer une réponse',
'update' => 'Mise à jour',
],

'editor' => [
'title' => 'Titre de '.trans('chatter::intro.titles.discussion'),
'select' => 'Choisir une Catégorie',
'tinymce_placeholder' => 'Tapez votre '.trans('chatter::intro.titles.discussion').' Ici...',
'select_color_text' => 'Choissisez une couleur pour ce '.trans('chatter::intro.titles.discussion').' (optionel)',
],

'email' => [
'notify' => 'Avertissez-moi quand quelqu\'un répond',
],

'auth' => 'S\'il vous plait <a href="/:home/login">Connectez-vous</a>
ou <a href="/:home/register">Créér un compte</a>
pour repondre.',

];
4 changes: 2 additions & 2 deletions src/Routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

// Route helper.
$route = function ($accessor, $default = '') {
return $this->app->config->get('chatter.routes.'.$accessor, $default);
return app()->config->get('chatter.routes.'.$accessor, $default);
};

// Middleware helper.
$middleware = function ($accessor, $default = []) {
return $this->app->config->get('chatter.middleware.'.$accessor, $default);
return app()->config->get('chatter.middleware.'.$accessor, $default);
};

// Authentication middleware helper.
Expand Down