PluginProbe ʕ •ᴥ•ʔ
Presto Player / trunk
Presto Player vtrunk
4.4.1 4.4.0 4.3.3 4.3.2 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 week ago Abilities 1 week ago Blocks 3 weeks ago License 1 month ago OAuth 1 week ago AdminNotice.php 2 months ago AdminNotices.php 2 months ago AjaxActions.php 2 months ago Blocks.php 2 years ago Compatibility.php 11 months ago FeatureAnnounce.php 1 week ago Learn.php 1 week ago Menu.php 1 week ago Migrations.php 2 years ago NpsSurvey.php 6 months ago Onboarding.php 2 months ago Player.php 3 weeks ago PluginInstaller.php 1 week ago PreloadService.php 1 year ago ProCompatibility.php 3 weeks ago ReusableVideos.php 1 month ago RewriteRulesManager.php 2 years ago Scripts.php 1 month ago Settings.php 3 months ago Shortcodes.php 1 week ago Streamer.php 2 months ago Translation.php 3 weeks ago Usage.php 1 week ago VideoPostType.php 3 weeks ago
Translation.php
155 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 'emailError' => __( 'Something went wrong. Please refresh the page and try again.', 'presto-player' ),
84 'chapters' => __( 'Chapters', 'presto-player' ),
85 'show_chapters' => __( 'Show Chapters', 'presto-player' ),
86 'hide_chapters' => __( 'Hide Chapters', 'presto-player' ),
87 'restart' => __( 'Restart', 'presto-player' ),
88 /* translators: {seektime} is replaced with the number of seconds, e.g. "Rewind 10s" */
89 'rewind' => __( 'Rewind {seektime}s', 'presto-player' ),
90 'play' => __( 'Play', 'presto-player' ),
91 'pause' => __( 'Pause', 'presto-player' ),
92 /* translators: {seektime} is replaced with the number of seconds, e.g. "Forward 10s" */
93 'fastForward' => __( 'Forward {seektime}s', 'presto-player' ),
94 'seek' => __( 'Seek', 'presto-player' ),
95 /* translators: {currentTime} = current playback time, {duration} = total video length */
96 'seekLabel' => __( '{currentTime} of {duration}', 'presto-player' ),
97 'played' => __( 'Played', 'presto-player' ),
98 'buffered' => __( 'Buffered', 'presto-player' ),
99 'currentTime' => __( 'Current time', 'presto-player' ),
100 'duration' => __( 'Duration', 'presto-player' ),
101 'volume' => __( 'Volume', 'presto-player' ),
102 'mute' => __( 'Mute', 'presto-player' ),
103 'unmute' => __( 'Unmute', 'presto-player' ),
104 'enableCaptions' => __( 'Enable captions', 'presto-player' ),
105 'disableCaptions' => __( 'Disable captions', 'presto-player' ),
106 'download' => __( 'Download', 'presto-player' ),
107 'enterFullscreen' => __( 'Enter fullscreen', 'presto-player' ),
108 'exitFullscreen' => __( 'Exit fullscreen', 'presto-player' ),
109 'frameTitle' => __( 'Player for {title}', 'presto-player' ),
110 'captions' => __( 'Captions', 'presto-player' ),
111 'settings' => __( 'Settings', 'presto-player' ),
112 'pip' => __( 'PIP', 'presto-player' ),
113 'menuBack' => __( 'Go back to previous menu', 'presto-player' ),
114 'speed' => __( 'Speed', 'presto-player' ),
115 'normal' => __( 'Normal', 'presto-player' ),
116 'quality' => __( 'Quality', 'presto-player' ),
117 'loop' => __( 'Loop', 'presto-player' ),
118 'start' => __( 'Start', 'presto-player' ),
119 'end' => __( 'End', 'presto-player' ),
120 'all' => __( 'All', 'presto-player' ),
121 'reset' => __( 'Reset', 'presto-player' ),
122 'disabled' => __( 'Disabled', 'presto-player' ),
123 'enabled' => __( 'Enabled', 'presto-player' ),
124 'advertisement' => __( 'Ad', 'presto-player' ),
125 'qualityBadge' => array(
126 2160 => __( '4K', 'presto-player' ),
127 1440 => __( 'HD', 'presto-player' ),
128 1080 => __( 'HD', 'presto-player' ),
129 720 => __( 'HD', 'presto-player' ),
130 576 => __( 'SD', 'presto-player' ),
131 480 => __( 'SD', 'presto-player' ),
132 ),
133 'auto' => __( 'AUTO', 'presto-player' ),
134 'next' => __( 'Next', 'presto-player' ),
135 'upNext' => __( 'Up Next', 'presto-player' ),
136 'startOver' => __( 'Start Over', 'presto-player' ),
137 );
138 }
139
140 /**
141 * Set translated preset names here after text domain is loaded.
142 *
143 * @return void
144 */
145 public function initPresetTranslations() {
146 $this->preset_name_translations = array(
147 'default' => __( 'Default', 'presto-player' ),
148 'course' => __( 'Course', 'presto-player' ),
149 'simple' => __( 'Simple', 'presto-player' ),
150 'minimal' => __( 'Minimal', 'presto-player' ),
151 'youtube' => __( 'YouTube Optimized', 'presto-player' ),
152 );
153 }
154 }
155