| @@ -38,9 +38,9 @@ | ||
| 38 | 38 | */ |
| 39 | 39 | public function register() |
| 40 | 40 | { |
| 41 | 41 | add_action('plugins_loaded', [$this, 'init_plugin']); |
| 42 | - // add_action('init', [$this, 'localization_setup']); | |
| 42 | + add_action('init', [$this, 'localization_setup']); | |
| 43 | 43 | (new Activation())->activate(); |
| 44 | 44 | (new Deactivation())->register(); |
| 45 | 45 | (new Uninstallation())->register(); |
| 46 | 46 | } |
| @@ -178,9 +178,25 @@ | ||
| 178 | 178 | new RegisterBitFormElementorWidget(); |
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - // public function localization_setup() | |
| 183 | - // { | |
| 184 | - // // load_plugin_textdomain('bit-form', false, dirname(BITFORMS_PLUGIN_BASENAME) . '/languages'); | |
| 185 | - // } | |
| 182 | + /** | |
| 183 | + * Registers the bundled translations directory for the `bit-form` text domain. | |
| 184 | + */ | |
| 185 | + public function localization_setup() | |
| 186 | + { | |
| 187 | + /** | |
| 188 | + * Filters whether Bit Form loads its bundled translations at all. | |
| 189 | + * | |
| 190 | + * Returning false leaves every Free string untranslated — the same filter gates | |
| 191 | + * the React admin bundle in Admin_Bar. Pro has its own | |
| 192 | + * `bitformpro_filter_allow_translation`. | |
| 193 | + * | |
| 194 | + * @param bool $allow Whether to load translations. Default true. | |
| 195 | + */ | |
| 196 | + if (!apply_filters('bitform_filter_allow_translation', true)) { | |
| 197 | + return; | |
| 198 | + } | |
| 199 | + | |
| 200 | + load_plugin_textdomain('bit-form', false, \dirname(BITFORMS_PLUGIN_BASENAME) . '/languages'); | |
| 201 | + } | |
| 186 | 202 | } |