| @@ 139-153 (lines=15) @@ | ||
| 136 | return !in_array($country . '_' . $locale, $locales); |
|
| 137 | } |
|
| 138 | ||
| 139 | public static function getLocale(string $locale): string |
|
| 140 | { |
|
| 141 | if (Str::contains($locale, '_')) |
|
| 142 | { |
|
| 143 | $tab = explode('_', $locale); |
|
| 144 | return $tab[1]; |
|
| 145 | } |
|
| 146 | else if (Str::contains($locale, '-')) |
|
| 147 | { |
|
| 148 | $tab = explode('-', $locale); |
|
| 149 | return $tab[1]; |
|
| 150 | } |
|
| 151 | ||
| 152 | return $locale; |
|
| 153 | } |
|
| 154 | ||
| 155 | public static function getCountry(string $locale): string |
|
| 156 | { |
|
| @@ 155-168 (lines=14) @@ | ||
| 152 | return $locale; |
|
| 153 | } |
|
| 154 | ||
| 155 | public static function getCountry(string $locale): string |
|
| 156 | { |
|
| 157 | if (Str::contains($locale, '_')) |
|
| 158 | { |
|
| 159 | $tab = explode('_', $locale); |
|
| 160 | return $tab[0]; |
|
| 161 | } else if (Str::contains($locale, '-')) |
|
| 162 | { |
|
| 163 | $tab = explode('-', $locale); |
|
| 164 | return $tab[0]; |
|
| 165 | } |
|
| 166 | ||
| 167 | return config('contentful.default_country'); |
|
| 168 | } |
|
| 169 | ||
| 170 | ||
| 171 | } |
|