Skip to content

Commit

Permalink
[ADD] Translations
Browse files Browse the repository at this point in the history
  • Loading branch information
RibesAlexandre committed Mar 20, 2023
1 parent 24ffbbc commit 7b791c2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 15 deletions.
15 changes: 15 additions & 0 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Redirect SEO": "Redirect SEO",
"SEO": "SEO",
"Enabled": "Enabled",
"From URL": "From URL",
"The URL you want to redirect from.": "The URL you want to redirect from.",
"The URL you want to redirect to.": "The URL you want to redirect to.",
"Status Code": "Status Code",
"301 (Permanent)": "301 (Permanent)",
"302 (Temporary)": "302 (Temporary)",
"Is Regex": "Is Regex",
"If you want to use regex for the from_url, check this box.": "If you want to use regex for the from_url, check this box.",
"posts/old-post or /posts\\/(.*)": "posts/old-post or /posts\\/(.*)",
"/posts/old-post or https://www.example.com/posts/old-post or /posts/$1": "/posts/old-post or https://www.example.com/posts/old-post or /posts/$1"
}
15 changes: 15 additions & 0 deletions resources/lang/fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Redirect SEO": "Redirection SEO",
"SEO": "Référencement",
"Enabled": "Actif",
"From URL": "Depuis l'URL",
"The URL you want to redirect from.": "L'URL depuis laquelle vous souhaitez rediriger.",
"The URL you want to redirect to.": "L'URL vers laquelle vous souhaitez rediriger.",
"Status Code": "Code de statut",
"301 (Permanent)": "301 (Permanent)",
"302 (Temporary)": "302 (Temporaire)",
"Is Regex": "Il s'agit d'une REGEX",
"If you want to use regex for the from_url, check this box.": "Si vous souhaitez utiliser une REGEX pour le champ \"Depuis l'URL\" cochez cette case.",
"posts/old-post or /posts\\/(.*)": "posts/old-post ou /posts\\/(.*)",
"/posts/old-post or https://www.example.com/posts/old-post or /posts/$1": "/posts/old-post ou https://www.exemple.com/posts/old-post ou /posts/$1"
}
32 changes: 17 additions & 15 deletions src/App/Nova/NovaRedirectorSeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class NovaRedirectorSeo extends Resource

public static function label()
{
return 'Redirect SEO';
return __('Redirect SEO');
}

public static function group()
{
return 'SEO';
return __('SEO');
}

/**
Expand Down Expand Up @@ -54,25 +54,27 @@ public function fields(NovaRequest $request)
{
return [
ID::make()->sortable(),
Boolean::make('Enabled')->default(true),
Text::make('From URL', 'from_url')
Boolean::make(__('Enabled'), 'enabled')->default(true),
Text::make(__('From URL'), 'from_url')
->rules('required', 'string', 'max:255')
->withMeta(['extraAttributes' => [
'placeholder' => 'posts/old-post or /posts\/(.*)'],
->withMeta([
'extraAttributes' => [
'placeholder' => __('posts/old-post or /posts\/(.*)')
],
])
->help('The URL you want to redirect from.'),
Text::make('To URL', 'to_url')
->help(__('The URL you want to redirect from.')),
Text::make(__('To URL'), 'to_url')
->rules('required', 'string', 'max:255')
->withMeta(['extraAttributes' => [
'placeholder' => '/posts/old-post or https://www.example.com/posts/old-post or /posts/$1'],
'placeholder' => __('/posts/old-post or https://www.example.com/posts/old-post or /posts/$1')],
])
->help('The URL you want to redirect to.'),
Select::make('Status Code', 'status_code')->options([
301 => '301 (Permanent)',
302 => '302 (Temporary)',
->help(__('The URL you want to redirect to.')),
Select::make(__('Status Code'), 'status_code')->options([
301 => __('301 (Permanent)'),
302 => __('302 (Temporary)'),
])->rules('required', 'integer', 'min:301', 'max:302'),
Boolean::make('Is Regex', 'is_regex')->default(false)
->help('If you want to use regex for the from_url, check this box.'),
Boolean::make(__('Is Regex'), 'is_regex')->default(false)
->help(__('If you want to use regex for the from_url, check this box.')),
];
}

Expand Down
1 change: 1 addition & 0 deletions src/NovaRedirectorSeoServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function configurePackage(Package $package): void
->name('nova-redirector-seo')
->hasConfigFile()
->hasViews()
->hasTranslations()
->hasMigration('create_nova-redirector-seo_table')
->hasCommand(NovaRedirectorSeoCommand::class);
}
Expand Down

0 comments on commit 7b791c2

Please sign in to comment.