| @@ 149-163 (lines=15) @@ | ||
| 146 | return !in_array($this->country . '_' . $this->locale, static::_getLocalesDisabled()); |
|
| 147 | } |
|
| 148 | ||
| 149 | public static function getLocale(string $locale): string |
|
| 150 | { |
|
| 151 | if (Str::contains($locale, '_')) |
|
| 152 | { |
|
| 153 | $tab = explode('_', $locale); |
|
| 154 | return $tab[1]; |
|
| 155 | } else if (Str::contains($locale, '-')) |
|
| 156 | { |
|
| 157 | $tab = explode('-', $locale); |
|
| 158 | return $tab[1]; |
|
| 159 | } |
|
| 160 | ||
| 161 | return $locale; |
|
| 162 | } |
|
| 163 | ||
| 164 | public static function getCountry(string $locale): string |
|
| 165 | { |
|
| 166 | if (Str::contains($locale, '_')) |
|
| @@ 164-177 (lines=14) @@ | ||
| 161 | return $locale; |
|
| 162 | } |
|
| 163 | ||
| 164 | public static function getCountry(string $locale): string |
|
| 165 | { |
|
| 166 | if (Str::contains($locale, '_')) |
|
| 167 | { |
|
| 168 | $tab = explode('_', $locale); |
|
| 169 | return $tab[0]; |
|
| 170 | } else if (Str::contains($locale, '-')) |
|
| 171 | { |
|
| 172 | $tab = explode('-', $locale); |
|
| 173 | return $tab[0]; |
|
| 174 | } |
|
| 175 | ||
| 176 | return config('contentful.default_country'); |
|
| 177 | } |
|
| 178 | ||
| 179 | ||
| 180 | /** |
|