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.2.1 4.2.2 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.8 4.3.9 4.4.0 4.4.1 4.4.10 4.4.11 4.4.12 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 5.10 5.10.1 5.10.2 5.11 5.11.1 5.11.2 5.11.3 5.11.4 5.12 5.12.1 5.12.2 5.12.3 5.12.4 5.12.5 5.12.6 5.6.10 5.6.2 5.6.3 5.6.4 5.6.5 5.6.6 5.6.7 5.6.8 5.6.9 5.7.0 5.7.1 5.7.10 5.7.12 5.7.13 5.7.2 5.7.3 5.7.4 5.7.5 5.7.6 5.7.7 5.7.8 5.7.9 5.8.0 5.8.1 5.8.10 5.8.11 5.8.12 5.8.13 5.8.14 5.8.2 5.8.3 5.8.4
advanced-custom-fields / includes / l10n.php
advanced-custom-fields / includes Last commit date
admin 1 month ago ajax 3 months ago api 4 weeks ago fields 4 weeks ago forms 4 weeks ago legacy 6 months ago locations 1 month ago post-types 5 months ago rest-api 4 weeks ago walkers 6 months ago acf-bidirectional-functions.php 6 months ago acf-field-functions.php 5 months ago acf-field-group-functions.php 6 months ago acf-form-functions.php 6 months ago acf-helper-functions.php 6 months ago acf-hook-functions.php 6 months ago acf-input-functions.php 6 months ago acf-internal-post-type-functions.php 6 months ago acf-meta-functions.php 2 months ago acf-post-functions.php 6 months ago acf-post-type-functions.php 6 months ago acf-taxonomy-functions.php 6 months ago acf-user-functions.php 6 months ago acf-utility-functions.php 6 months ago acf-value-functions.php 6 months ago acf-wp-functions.php 6 months ago assets.php 5 months ago class-acf-data.php 6 months ago class-acf-internal-post-type.php 6 months ago compatibility.php 6 months ago deprecated.php 6 months ago fields.php 6 months ago index.php 2 years ago l10n.php 6 months ago local-fields.php 6 months ago local-json.php 3 months ago local-meta.php 6 months ago locations.php 6 months ago loop.php 6 months ago media.php 6 months ago rest-api.php 6 months ago revisions.php 3 months ago third-party.php 6 months ago upgrades.php 2 months ago validation.php 6 months ago wpml.php 6 months ago
l10n.php
157 lines
1 <?php
2 /**
3 * @package ACF
4 * @author WP Engine
5 *
6 * © 2026 Advanced Custom Fields (ACF®). All rights reserved.
7 * "ACF" is a trademark of WP Engine.
8 * Licensed under the GNU General Public License v2 or later.
9 * https://www.gnu.org/licenses/gpl-2.0.html
10 */
11
12 /**
13 * Determine the current locale desired for the request.
14 *
15 * @since 5.0.0
16 *
17 * @global string $pagenow
18 *
19 * @return string The determined locale.
20 */
21 if ( ! function_exists( 'determine_locale' ) ) :
22 function determine_locale() {
23 /**
24 * Filters the locale for the current request prior to the default determination process.
25 *
26 * Using this filter allows to override the default logic, effectively short-circuiting the function.
27 *
28 * @since 5.0.0
29 *
30 * @param string|null The locale to return and short-circuit, or null as default.
31 */
32 $determined_locale = apply_filters( 'pre_determine_locale', null );
33 if ( ! empty( $determined_locale ) && is_string( $determined_locale ) ) {
34 return $determined_locale;
35 }
36
37 $determined_locale = get_locale();
38
39 if ( function_exists( 'get_user_locale' ) && is_admin() ) {
40 $determined_locale = get_user_locale();
41 }
42
43 // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Copied from WordPress core.
44 if ( function_exists( 'get_user_locale' ) && isset( $_GET['_locale'] ) && 'user' === $_GET['_locale'] ) {
45 $determined_locale = get_user_locale();
46 }
47
48 if ( ! empty( $_GET['wp_lang'] ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) {
49 $determined_locale = sanitize_text_field( $_GET['wp_lang'] );
50 }
51 // phpcs:enable WordPress.Security.NonceVerification.Recommended
52
53 /**
54 * Filters the locale for the current request.
55 *
56 * @since 5.0.0
57 *
58 * @param string $locale The locale.
59 */
60 return apply_filters( 'determine_locale', $determined_locale );
61 }
62 endif;
63
64 /**
65 * Returns the current locale.
66 *
67 * @date 16/12/16
68 * @since 5.5.0
69 *
70 * @param void
71 * @return string
72 */
73 function acf_get_locale() {
74
75 // Determine local.
76 $locale = determine_locale();
77
78 // Fallback to parent language for regions without translation.
79 // https://wpastra.com/docs/complete-list-wordpress-locale-codes/
80 $langs = array(
81 'az_TR' => 'az', // Azerbaijani (Turkey)
82 'zh_HK' => 'zh_TW', // Chinese (Hong Kong)
83 'fr_BE' => 'fr_FR', // French (Belgium)
84 'nn_NO' => 'nb_NO', // Norwegian (Nynorsk)
85 'fa_AF' => 'fa_IR', // Persian (Afghanistan)
86 'ru_UA' => 'ru_RU', // Russian (Ukraine)
87 );
88 if ( isset( $langs[ $locale ] ) ) {
89 $locale = $langs[ $locale ];
90 }
91
92 /**
93 * Filters the determined local.
94 *
95 * @date 8/1/19
96 * @since 5.7.10
97 *
98 * @param string $locale The local.
99 */
100 return apply_filters( 'acf/get_locale', $locale );
101 }
102
103 /**
104 * acf_load_textdomain
105 *
106 * Loads the plugin's translated strings similar to load_plugin_textdomain().
107 *
108 * @date 8/1/19
109 * @since 5.7.10
110 *
111 * @param string $locale The plugin's current locale.
112 * @return void
113 */
114 function acf_load_textdomain( $domain = 'acf' ) {
115
116 /**
117 * Filters a plugin's locale.
118 *
119 * @date 8/1/19
120 * @since 5.7.10
121 *
122 * @param string $locale The plugin's current locale.
123 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
124 */
125 $locale = apply_filters( 'plugin_locale', acf_get_locale(), $domain );
126 $mofile = $domain . '-' . $locale . '.mo';
127
128 // Load from plugin lang folder.
129 return load_textdomain( $domain, acf_get_path( 'lang/' . $mofile ) );
130 }
131
132 /**
133 * _acf_apply_language_cache_key
134 *
135 * Applies the current language to the cache key.
136 *
137 * @date 23/1/19
138 * @since 5.7.11
139 *
140 * @param string $key The cache key.
141 * @return string
142 */
143 function _acf_apply_language_cache_key( $key ) {
144
145 // Get current language.
146 $current_language = acf_get_setting( 'current_language' );
147 if ( $current_language ) {
148 $key = "{$key}:{$current_language}";
149 }
150
151 // Return key.
152 return $key;
153 }
154
155 // Hook into filter.
156 add_filter( 'acf/get_cache_key', '_acf_apply_language_cache_key' );
157