Changeset 10829 for sites/trunk/wordpress.org/public_html/wp-content/plugins/locale-detection/class-detector.php
- Timestamp:
- 03/18/2021 05:13:45 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/locale-detection/class-detector.php
r10106 r10829 174 174 public function check_variants( $locale ) { 175 175 $locale = str_replace( '-', '_', $locale ); 176 $locale = explode( '_', $locale, 2);176 $locale = explode( '_', $locale, 3 ); 177 177 $variants = []; 178 178 179 179 if ( 1 === count( $locale ) ) { 180 180 $lang = strtolower( $locale[0] ); 181 } elseif ( 2 === count( $locale ) ) { 182 list( $lang, $region ) = $locale; 183 184 $lang = strtolower( $lang ); 185 $variants[] = $lang . '_' . strtolower( $region ); 186 $variants[] = $lang . '_' . strtoupper( $region ); 181 187 } else { 182 list( $lang, $region ) = $locale;188 list( $lang, $region, $variant ) = $locale; 183 189 184 190 $lang = strtolower( $lang ); 191 $variant = strtolower( $variant ); 192 $variants[] = $lang . '_' . strtolower( $region ) . '_' . $variant; 193 $variants[] = $lang . '_' . strtoupper( $region ) . '_' . $variant; 194 $variants[] = $lang . '_' . strtolower( $region ); 185 195 $variants[] = $lang . '_' . strtoupper( $region ); 186 196 }
Note: See TracChangeset
for help on using the changeset viewer.