1 | <?php |
||
32 | class MultilingualContext extends RawMultilingualContext { |
||
33 | |||
34 | /** Multilanguage implementation */ |
||
35 | |||
36 | // Declaring translations variable to store all translations |
||
37 | public $translations = array(); |
||
38 | |||
39 | public $languages_iso_codes = array(); |
||
40 | |||
41 | |||
42 | // Parse the YAML translations to PHP array variable |
||
43 | public function parseTranslationFile() { |
||
53 | |||
54 | public function initializeMultilanguage() { |
||
60 | |||
61 | /* |
||
62 | * This function parses the languages_iso_codes.json file to an array |
||
63 | */ |
||
64 | |||
65 | public function parseLanguageCodes() { |
||
69 | |||
70 | /* |
||
71 | * This function detects site's language based on URL. If no URL language is detected |
||
72 | * the default_language is used. |
||
73 | */ |
||
74 | |||
75 | public function languageDetection() { |
||
90 | |||
91 | /** |
||
92 | * This function localizes the targeted string. It tries to find a definition of the provided text (in English) |
||
93 | * in the translations file that is provided within the profile parameters. If it fails to find translation |
||
94 | * for the requested language it falls back to English. If the string is not defined at all in the translations |
||
95 | * file there will be an exception thrown. |
||
96 | */ |
||
97 | |||
98 | public function localizeTarget($target) { |
||
109 | |||
110 | /** |
||
111 | * This function localizes the field based on Drupal standards. English language is used as a base. |
||
112 | */ |
||
113 | |||
114 | public function localizeField($field) { |
||
120 | |||
121 | |||
122 | /** |
||
123 | * Initialize the multilingual context a.k.a parses the YAML file translations into an array. |
||
124 | * @BeforeScenario |
||
125 | * @Given /^I initialize multilingual context/ |
||
126 | */ |
||
127 | public function iInitializeMultilingualContext() { |
||
130 | |||
131 | /** |
||
132 | * |
||
133 | * @Given /^I follow localized "(?P<link>(?:[^"]|\\")*)"/ |
||
134 | */ |
||
135 | public function iFollowLocalized($target) { |
||
147 | |||
148 | /** |
||
149 | * |
||
150 | * @Given /^I follow second localized "(?P<link>(?:[^"]|\\")*)"/ |
||
151 | */ |
||
152 | public function iFollowLocalizedSecond($target) { |
||
156 | |||
157 | /** |
||
158 | * Click on some text. |
||
159 | * |
||
160 | * @When /^I click on the localized text "([^"]*)"$/ |
||
161 | */ |
||
162 | |||
163 | public function iClickOnTheLocalizedText($target) { |
||
167 | |||
168 | /** |
||
169 | * Checks, that page contains specified text in input |
||
170 | * |
||
171 | * @Then /^(?:|I )should see localized value "(?P<text>(?:[^"]|\\")*)" in input "([^"]*)"$/ |
||
172 | */ |
||
173 | |||
174 | public function iShouldSeeLocalizedValueInInput($value, $input) { |
||
178 | |||
179 | /** |
||
180 | * Checks, that page contains specified text |
||
181 | * |
||
182 | * @Then /^(?:|I )should see localized "(?P<text>(?:[^"]|\\")*)"$/ |
||
183 | */ |
||
184 | |||
185 | public function iShouldSeeLocalized($target) { |
||
189 | |||
190 | /** |
||
191 | * Checks, that page doesn't contain specified text |
||
192 | * |
||
193 | * @Then /^(?:|I )should not see localized "(?P<text>(?:[^"]|\\")*)"$/ |
||
194 | */ |
||
195 | public function iShouldNotSeeLocalized($target) |
||
200 | |||
201 | /** |
||
202 | * Waiting for text to appear on a page with certain execution time |
||
203 | * |
||
204 | * @When /^I wait for localized text "([^"]*)" to appear with max time "([^"]+)"(?: seconds)?$/ |
||
205 | */ |
||
206 | public function iWaitForLocalizedTextToAppearWithMaxTime($target, $maxExecutionTime){ |
||
210 | |||
211 | /** |
||
212 | * Fills in form field with specified id|name|label|value |
||
213 | * Example: When I fill in "username" with: "bwayne" |
||
214 | * Example: And I fill in "bwayne" for "username" |
||
215 | * |
||
216 | * @When /^(?:|I )fill in localized "(?P<field>(?:[^"]|\\")*)" with "(?P<value>(?:[^"]|\\")*)"$/ |
||
217 | * @When /^(?:|I )fill in localized "(?P<field>(?:[^"]|\\")*)" with:$/ |
||
218 | * @When /^(?:|I )fill in localized "(?P<value>(?:[^"]|\\")*)" for "(?P<field>(?:[^"]|\\")*)"$/ |
||
219 | */ |
||
220 | public function fillLocalizedField($field, $value) |
||
225 | |||
226 | /** |
||
227 | * @Given I click localized :link in the :rowText row |
||
228 | * @Then I (should )see the localized :link in the :rowText row |
||
229 | */ |
||
230 | public function assertLocalizedClickInTableRow($link, $rowText){ |
||
240 | |||
241 | public function getTableRow(Element $element, $search) { |
||
253 | |||
254 | /** |
||
255 | * Click on text in specified region |
||
256 | * |
||
257 | * @When /^I click on the localized text "([^"]*)" in the "(?P<region>[^"]*)"(?:| region)$/ |
||
258 | */ |
||
259 | public function iClickOnTheLocalizedTextInRegion($text, $region){ |
||
263 | |||
264 | /** |
||
265 | * Choose certain option from given selector |
||
266 | * |
||
267 | * @When I select localized :option from chosen :selector |
||
268 | */ |
||
269 | public function lselectLocalizedOptionWithJavascript($selector, $option) { |
||
273 | |||
274 | /** |
||
275 | * @When I select the localized radio button :label with the id :id |
||
276 | * @When I select the localized radio button :label |
||
277 | * |
||
278 | */ |
||
279 | public function assertSelectLocalizedRadioById($label, $id = '') { |
||
283 | } |
||
284 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..