PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.5
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | src/helpers/language-helper.php +28 -0 18.228.5 View file →
@@ -10,8 +10,15 @@
10 10 */
11 11 class Language_Helper {
12 12
13 13 /**
14 + * The languages with inclusive language analysis support.
15 + *
16 + * @var string[]
17 + */
18 + public static $languages_with_inclusive_language_support = [ 'en' ];
19 +
20 + /**
14 21 * Checks whether word form recognition is active for the used language.
15 22 *
16 23 * @param string $language The used language.
17 24 *
@@ -37,8 +44,19 @@
37 44 return \in_array( $language, $supported_languages, true );
38 45 }
39 46
40 47 /**
48 + * Checks whether the given language has inclusive language support.
49 + *
50 + * @param string $language The language to check if inclusive language is supported.
51 + *
52 + * @return bool Whether the language has inclusive language support.
53 + */
54 + public function has_inclusive_language_support( $language ) {
55 + return \in_array( $language, self::$languages_with_inclusive_language_support, true );
56 + }
57 +
58 + /**
41 59 * Checks whether we have a specific researcher for the current locale and returns that language.
42 60 * If there is no researcher for the current locale, returns default as the researcher.
43 61 *
44 62 * @return string The language to use to select a researcher.
@@ -50,6 +68,16 @@
50 68 if ( ! \in_array( $researcher_language, $supported_languages, true ) ) {
51 69 $researcher_language = 'default';
52 70 }
53 71 return $researcher_language;
72 + }
73 +
74 + /**
75 + * Returns The site language code without region
76 + * (e.g. 'en' for 'en_US' or 'en_GB').
77 + *
78 + * @return string The site language code without region.
79 + */
80 + public function get_language() {
81 + return WPSEO_Language_Utils::get_language( \get_locale() );
54 82 }
55 83 }