Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jyrkidn committed Dec 7, 2023
2 parents e47017b + 707a3b8 commit c36ba9d
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v0.1.11 - 2023-10-12

### What's Changed

- Bump locale collection package

## v0.1.0 - 2023-08-18

### What's Changed
Expand Down
13 changes: 13 additions & 0 deletions src/Facades/TranslateRouteParts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Codedor\TranslatableRoutes\Facades;

use Illuminate\Support\Facades\Facade;

class TranslateRouteParts extends Facade
{
protected static function getFacadeAccessor()
{
return \Codedor\TranslatableRoutes\TranslateRouteParts::class;
}
}
5 changes: 5 additions & 0 deletions src/Providers/TranslatableRoutesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Codedor\LocaleCollection\Locale;
use Codedor\LocaleCollection\LocaleCollection;
use Codedor\TranslatableRoutes\TranslateRoute;
use Codedor\TranslatableRoutes\TranslateRouteParts;
use Codedor\TranslatableRoutes\View\Components\HrefLangTags;
use Illuminate\Routing\Route as RoutingRoute;
use Illuminate\Support\Facades\Blade;
Expand Down Expand Up @@ -64,6 +65,10 @@ public function packageBooted(): void
parent::packageBooted();

$this->registerBladeComponents();

$this->app->bind(TranslateRouteParts::class, function () {
return new TranslateRouteParts;
});
}

protected function registerBladeComponents()
Expand Down
2 changes: 2 additions & 0 deletions src/TranslateRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Codedor\LocaleCollection\Facades\LocaleCollection;
use Codedor\LocaleCollection\Locale;
use Codedor\LocaleCollection\LocaleCollection as TranslatableRoutesLocaleCollection;
use Codedor\TranslatableRoutes\Facades\TranslateRouteParts;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Routing\Exceptions\UrlGenerationException;
Expand Down Expand Up @@ -83,6 +84,7 @@ public static function translateParts(string $uri, string $locale)
}

$key = "routes.$part";
TranslateRouteParts::put($key, $key);

if (app('translator')->has($key, $locale)) {
$translatedUri[] = app('translator')->get($key, [], $locale);
Expand Down
9 changes: 9 additions & 0 deletions src/TranslateRouteParts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Codedor\TranslatableRoutes;

use Illuminate\Support\Collection;

class TranslateRouteParts extends Collection
{
}
2 changes: 1 addition & 1 deletion src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ function is_filament_livewire_route($request): bool
if (! function_exists('is_livewire_route')) {
function is_livewire_route($request): bool
{
return (Str::startsWith($request->path(), 'livewire/') || $request->headers->has('X-LIVEWIRE'));
return Str::startsWith($request->path(), 'livewire/') || $request->headers->has('X-LIVEWIRE');
}
}

0 comments on commit c36ba9d

Please sign in to comment.