+ /**
+ * Convert localized digits to english digits.
+ *
+ * based on Language::parseFormattedNumber but without commas.
+ *
+ * @param string $string sortkey to unlocalize digits of
+ * @return string Sortkey with all localized digits replaced with ASCII digits.
+ */
+ private function convertDigits( $string ) {
+ $table = $this->digitTransformLang->digitTransformTable();
+ if ( $table ) {
+ $table = array_filter( $table );
+ $flipped = array_flip( $table );
+ // Some languages seem to also have commas in this table.
+ $flipped = array_filter( $flipped, 'is_numeric' );
+ $string = strtr( $string, $flipped );
+ }
+ return $string;
+ }
+