PluginProbe ʕ •ᴥ•ʔ
Presto Player / 4.3.1
Presto Player v4.3.1
4.3.1 4.3.0 4.2.4 4.2.3 4.2.2 4.2.0 4.2.1 trunk 1.10.0 1.10.1 1.10.2 1.11.0 1.12.0 1.13.0 1.14.0 1.14.1 1.5.10 1.5.11 1.5.12 1.5.13 1.5.14 1.5.15 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.13 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3-beta1 2.3.0 2.3.1 2.3.2 2.3.3 3.0.0 3.0.0-beta1 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.1.0 3.1.1 3.1.2 3.1.3 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4
presto-player / inc / Services / Translation.php
presto-player / inc / Services Last commit date
API 1 month ago Blocks 10 months ago License 1 month ago AdminNotice.php 3 weeks ago AdminNotices.php 3 weeks ago AjaxActions.php 3 weeks ago Blocks.php 1 year ago Compatibility.php 10 months ago Learn.php 1 month ago Menu.php 1 month ago Migrations.php 1 year ago NpsSurvey.php 5 months ago Onboarding.php 3 weeks ago Player.php 3 days ago PluginInstaller.php 1 month ago PreloadService.php 1 year ago ProCompatibility.php 1 month ago ReusableVideos.php 2 weeks ago RewriteRulesManager.php 1 year ago Scripts.php 2 weeks ago Settings.php 1 month ago Shortcodes.php 1 month ago Streamer.php 3 weeks ago Translation.php 3 weeks ago Usage.php 3 weeks ago VideoPostType.php 2 weeks ago
Translation.php
154 lines
1 <?php
2 /**
3 * Translation.
4 *
5 * @package PrestoPlayer\Services
6 */
7
8 namespace PrestoPlayer\Services;
9
10 use PrestoPlayer\Models\Setting;
11 use PrestoPlayer\Contracts\Service;
12
13 /**
14 * Translation.
15 */
16 class Translation implements Service {
17
18 /**
19 * Preset name translations.
20 *
21 * @var array
22 */
23 protected $preset_name_translations = array();
24
25 /**
26 * Register the service.
27 *
28 * @return void
29 */
30 public function register() {
31 add_filter( 'presto_player/presto_player_presets/data', array( $this, 'translateDefaultPresets' ) );
32 add_action( 'init', array( $this, 'loadPluginTextDomain' ), 0 );
33 add_action( 'init', array( $this, 'initPresetTranslations' ), 0 );
34 }
35
36 /**
37 * This is needed for Loco translate to work properly.
38 *
39 * @return void
40 */
41 public function loadPluginTextDomain() {
42 load_plugin_textdomain( 'presto-player', false, dirname( plugin_basename( PRESTO_PLAYER_PLUGIN_FILE ) ) . '/languages' );
43 }
44
45 /**
46 * Translate the default presets.
47 *
48 * @param object $preset Preset object.
49 * @return object
50 */
51 public function translateDefaultPresets( $preset ) {
52 if ( empty( $preset->is_locked ) ) {
53 return $preset;
54 }
55
56 // Translate name.
57 $preset->name = isset( $this->preset_name_translations[ $preset->slug ] ) ? $this->preset_name_translations[ $preset->slug ] : $preset->name;
58
59 // Youtube options.
60 if ( 'youtube' === $preset->slug ) {
61 $preset->action_bar['text'] = __( 'Subscribe To Our YouTube Channel', 'presto-player' );
62 // Unset action bar if no channel id.
63 if ( ! Setting::get( 'youtube', 'channel_id' ) ) {
64 unset( $preset->action_bar );
65 return $preset;
66 }
67 }
68
69 return $preset;
70 }
71
72 /**
73 * Get the i18n.
74 *
75 * @return array
76 */
77 public static function geti18n() {
78 return array(
79 'skip' => __( 'Skip', 'presto-player' ),
80 'rewatch' => __( 'Rewatch', 'presto-player' ),
81 'emailPlaceholder' => __( 'Email address', 'presto-player' ),
82 'emailDefaultHeadline' => __( 'Enter your email to play this episode.', 'presto-player' ),
83 'chapters' => __( 'Chapters', 'presto-player' ),
84 'show_chapters' => __( 'Show Chapters', 'presto-player' ),
85 'hide_chapters' => __( 'Hide Chapters', 'presto-player' ),
86 'restart' => __( 'Restart', 'presto-player' ),
87 /* translators: {seektime} is replaced with the number of seconds, e.g. "Rewind 10s" */
88 'rewind' => __( 'Rewind {seektime}s', 'presto-player' ),
89 'play' => __( 'Play', 'presto-player' ),
90 'pause' => __( 'Pause', 'presto-player' ),
91 /* translators: {seektime} is replaced with the number of seconds, e.g. "Forward 10s" */
92 'fastForward' => __( 'Forward {seektime}s', 'presto-player' ),
93 'seek' => __( 'Seek', 'presto-player' ),
94 /* translators: {currentTime} = current playback time, {duration} = total video length */
95 'seekLabel' => __( '{currentTime} of {duration}', 'presto-player' ),
96 'played' => __( 'Played', 'presto-player' ),
97 'buffered' => __( 'Buffered', 'presto-player' ),
98 'currentTime' => __( 'Current time', 'presto-player' ),
99 'duration' => __( 'Duration', 'presto-player' ),
100 'volume' => __( 'Volume', 'presto-player' ),
101 'mute' => __( 'Mute', 'presto-player' ),
102 'unmute' => __( 'Unmute', 'presto-player' ),
103 'enableCaptions' => __( 'Enable captions', 'presto-player' ),
104 'disableCaptions' => __( 'Disable captions', 'presto-player' ),
105 'download' => __( 'Download', 'presto-player' ),
106 'enterFullscreen' => __( 'Enter fullscreen', 'presto-player' ),
107 'exitFullscreen' => __( 'Exit fullscreen', 'presto-player' ),
108 'frameTitle' => __( 'Player for {title}', 'presto-player' ),
109 'captions' => __( 'Captions', 'presto-player' ),
110 'settings' => __( 'Settings', 'presto-player' ),
111 'pip' => __( 'PIP', 'presto-player' ),
112 'menuBack' => __( 'Go back to previous menu', 'presto-player' ),
113 'speed' => __( 'Speed', 'presto-player' ),
114 'normal' => __( 'Normal', 'presto-player' ),
115 'quality' => __( 'Quality', 'presto-player' ),
116 'loop' => __( 'Loop', 'presto-player' ),
117 'start' => __( 'Start', 'presto-player' ),
118 'end' => __( 'End', 'presto-player' ),
119 'all' => __( 'All', 'presto-player' ),
120 'reset' => __( 'Reset', 'presto-player' ),
121 'disabled' => __( 'Disabled', 'presto-player' ),
122 'enabled' => __( 'Enabled', 'presto-player' ),
123 'advertisement' => __( 'Ad', 'presto-player' ),
124 'qualityBadge' => array(
125 2160 => __( '4K', 'presto-player' ),
126 1440 => __( 'HD', 'presto-player' ),
127 1080 => __( 'HD', 'presto-player' ),
128 720 => __( 'HD', 'presto-player' ),
129 576 => __( 'SD', 'presto-player' ),
130 480 => __( 'SD', 'presto-player' ),
131 ),
132 'auto' => __( 'AUTO', 'presto-player' ),
133 'next' => __( 'Next', 'presto-player' ),
134 'upNext' => __( 'Up Next', 'presto-player' ),
135 'startOver' => __( 'Start Over', 'presto-player' ),
136 );
137 }
138
139 /**
140 * Set translated preset names here after text domain is loaded.
141 *
142 * @return void
143 */
144 public function initPresetTranslations() {
145 $this->preset_name_translations = array(
146 'default' => __( 'Default', 'presto-player' ),
147 'course' => __( 'Course', 'presto-player' ),
148 'simple' => __( 'Simple', 'presto-player' ),
149 'minimal' => __( 'Minimal', 'presto-player' ),
150 'youtube' => __( 'YouTube Optimized', 'presto-player' ),
151 );
152 }
153 }
154