PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.3.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.3.1
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
bit-form / includes / Core / Util / Translation / Contract / TranslationProviderInterface.php

TranslationProviderInterface.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 3.3.1, at includes/Core/Util/Translation/Contract/TranslationProviderInterface.php

58 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Core\Util\Translation\Contract;
4
5 /**
6 * Adapter contract for one multilingual plugin — lookup only. TranslationManager
7 * wires the provider to the public filters; a provider hooks nothing on its own.
8 *
9 * Plugins with a string store additionally implement
10 * StringRegistrationProviderInterface; the ones that translate rendered HTML
11 * do not, and are not forced into empty method bodies.
12 *
13 * No strict scalar type hints on hook-reachable methods (translate,
14 * getCurrentLanguage) — WP filters can pass null.
15 */
16 interface TranslationProviderInterface
17 {
18 /**
19 * Cheap probe: defined()/function_exists()/class_exists() only, no DB access.
20 *
21 * @return bool
22 */
23 public static function isAvailable();
24
25 /**
26 * Resolved language for the current request, memoized; '' when unknown.
27 *
28 * @return string
29 */
30 public function getCurrentLanguage();
31
32 /**
33 * `bitform_translate_form_string` delegate.
34 *
35 * @param mixed $string
36 * @param mixed $context stable context key (e.g. "fld-abc-lbl", "msg-content-3")
37 * @param mixed $formId
38 *
39 * @return mixed translated string, or the input unchanged
40 */
41 public function translate($string, $context = '', $formId = 0);
42
43 /**
44 * True when the plugin translates the rendered HTML itself; the manager then
45 * skips the string filter on frontend renders to avoid double translation.
46 *
47 * @return bool
48 */
49 public function translatesRenderedHtml();
50
51 /**
52 * AJAX context: adopt the submitter's page language.
53 *
54 * @param string $requestLang sanitized bf_lang from the payload, '' if none
55 */
56 public function onAjaxInit($requestLang);
57 }
58