PluginProbe
Responsive Menu – Create Mobile-Friendly Menu / 3.0.12
Responsive Menu – Create Mobile-Friendly Menu v3.0.12
4.7.3 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.10 4.1.11 4.1.12 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 All 90 releases
responsive-menu / src / app / Translation / Translator.php

Translator.php in Responsive Menu – Create Mobile-Friendly Menu 3.0.12, at src/app/Translation/Translator.php

42 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ResponsiveMenu\Translation;
4 use ResponsiveMenu\Models\Option;
5 use ResponsiveMenu\Collections\OptionsCollection;
6
7 class Translator {
8
9 private $translatables = [
10 'menu_to_use',
11 'button_title',
12 'menu_title',
13 'menu_title_link',
14 'menu_additional_content'
15 ];
16
17 public function translate(Option $option) {
18 // WPML Support
19 $translated = apply_filters('wpml_translate_single_string', $option->getValue(), 'Responsive Menu', $option->getName());
20
21 // Polylang Support
22 $translated = function_exists('pll__') ? pll__($translated) : $translated;
23
24 return $translated;
25 }
26
27 public function searchUrl() {
28 return function_exists('icl_get_home_url') ? icl_get_home_url() : get_home_url();
29 }
30
31 public function saveTranslations(OptionsCollection $options) {
32 foreach($this->translatables as $option_name)
33 if(isset($options[$option_name]))
34 do_action('wpml_register_single_string', 'Responsive Menu', $option_name, $options[$option_name]->getValue());
35 }
36
37 public function allowShortcode($text) {
38 return do_shortcode($text);
39 }
40
41 }
42