Skip to content

Commit 96bef97

Browse files
committed
only fetching languages supported in Wordpress
1 parent 5e5a64a commit 96bef97

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

includes/Services/LanguageService.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ class LanguageService {
1515
* @return array List of language data
1616
*/
1717
public static function get_all_languages() {
18-
// Get available languages
19-
$languages = \get_available_languages();
20-
2118
// Load translation-install.php if the function doesn't exist
2219
if ( ! function_exists( 'wp_get_available_translations' ) ) {
2320
require_once ABSPATH . 'wp-admin/includes/translation-install.php';
@@ -41,15 +38,12 @@ public static function get_all_languages() {
4138
);
4239

4340
// Add translated languages with proper format
44-
foreach ( $languages as $locale ) {
45-
if ( isset( $translations[ $locale ] ) ) {
46-
$translation = $translations[ $locale ];
47-
$formatted_languages[] = array(
48-
'code' => $locale,
49-
'name' => $translation['english_name'],
50-
'native_name' => $translation['native_name'],
51-
);
52-
}
41+
foreach ( $languages as $locale => $translation ) {
42+
$formatted_languages[] = array(
43+
'code' => $locale,
44+
'name' => $translation['english_name'],
45+
'native_name' => $translation['native_name'],
46+
);
5347
}
5448

5549
return $formatted_languages;

0 commit comments

Comments
 (0)