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