Gherkin/I18n.pm

filter: Statementstmt 100% 41 / 41 Branchbran 100% 2 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 33.3% 1 / 3 totaltotal 92.7% 51 / 55 CC 6 SCAR 9.7
CC
6
Cov
98%
patterns
4.0
language_info
3.0
BEGIN
1.0
CRAP 2.6
« Gherkin/Node/Step.pm ↑ Summary Gherkin/Node/Table.pm »
1 package Test::Pcuke::Gherkin::I18n;
2  
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 Test::Pcuke::Gherkin::I18n - provides internationalized regexps to the lexer
11  
12 =head1 SYNOPSIS
13  
14 use Test::Pcuke::Gherkin::I18n;
15  
16 my $regexps = Test::Pcuke::Gherkin::I18n->patterns('ru');
17
18 print join "\n", map { utf8::encode($_); $_ } @{ Test::Pcuke::Gherkin::I18n->languages };
19
20 my $ru_info = Test::Pcuke::Gherkin::I18n->language_info('ru');
21
22 foreach (@$ru_info) {
23 utf8::encode($_->[0]);
24 utf8::encode($_->[1]);
25 print join " -> ", @$_;
26 }
27  
28 =head1 METHODS
29  
30 =head2 patterns
31  
32 =cut
33  
34 3 my $translations = {
35 'ar' => {
36 "and" => "*|و",
37 "background" => "الخلفية",
38 "but" => "*|لكن",
39 "examples" => "امثلة",
40 "feature" => "خاصية",
41 "given" => "*|بفرض",
42 "name" => "Arabic",
43 "native" => "العربية",
44 "scenario" => "سيناريو",
45 "outline" => "سيناريو مخطط",
46 "then" => "*|اذاً|ثم",
47 "when" => "*|متى|عندما",
48 },
49 'bg' => {
50 "and" => "*|И",
51 "background" => "Предистория",
52 "but" => "*|Но",
53 "examples" => "Примери",
54 "feature" => "Функционалност",
55 "given" => "*|Дадено",
56 "name" => "Bulgarian",
57 "native" => "български",
58 "scenario" => "Сценарий",
59 "outline" => "Рамка на сценарий",
60 "then" => "*|То",
61 "when" => "*|Когато",
62 },
63 'ca' => {
64 "and" => "*|I",
65 "background" => "Rerefons|Antecedents",
66 "but" => "*|Però",
67 "examples" => "Exemples",
68 "feature" => "Característica|Funcionalitat",
69 "given" => "*|Donat|Donada|Atès|Atesa",
70 "name" => "Catalan",
71 "native" => "català",
72 "scenario" => "Escenari",
73 "outline" => "Esquema de l'escenari",
74 "then" => "*|Aleshores|Cal",
75 "when" => "*|Quan",
76 },
77 'cs' => {
78 "and" => "*|A|A také",
79 "background" => "Pozadí|Kontext",
80 "but" => "*|Ale",
81 "examples" => "Příklady",
82 "feature" => "Požadavek",
83 "given" => "*|Pokud",
84 "name" => "Czech",
85 "native" => "Česky",
86 "scenario" => "Scénář",
87 "outline" => "Náčrt Scénáře|Osnova scénáře",
88 "then" => "*|Pak",
89 "when" => "*|Když",
90 },
91 'cy-GB' => {
92 "and" => "*|A",
93 "background" => "Cefndir",
94 "but" => "*|Ond",
95 "examples" => "Enghreifftiau",
96 "feature" => "Arwedd",
97 "given" => "*|Anrhegedig a",
98 "name" => "Welsh",
99 "native" => "Cymraeg",
100 "scenario" => "Scenario",
101 "outline" => "Scenario Amlinellol",
102 "then" => "*|Yna",
103 "when" => "*|Pryd",
104 },
105 'da' => {
106 "and" => "*|Og",
107 "background" => "Baggrund",
108 "but" => "*|Men",
109 "examples" => "Eksempler",
110 "feature" => "Egenskab",
111 "given" => "*|Givet",
112 "name" => "Danish",
113 "native" => "dansk",
114 "scenario" => "Scenarie",
115 "outline" => "Abstrakt Scenario",
116 "then" => "*|Så",
117 "when" => "*|Når",
118 },
119 'de' => {
120 "and" => "*|Und",
121 "background" => "Grundlage",
122 "but" => "*|Aber",
123 "examples" => "Beispiele",
124 "feature" => "Funktionalität",
125 "given" => "*|Angenommen|Gegeben sei",
126 "name" => "German",
127 "native" => "Deutsch",
128 "scenario" => "Szenario",
129 "outline" => "Szenariogrundriss",
130 "then" => "*|Dann",
131 "when" => "*|Wenn",
132 },
133 'en' => {
134 "and" => "*|And",
135 "background" => "Background",
136 "but" => "*|But",
137 "examples" => "Examples|Scenarios",
138 "feature" => "Feature",
139 "given" => "*|Given",
140 "name" => "English",
141 "native" => "English",
142 "scenario" => "Scenario",
143 "outline" => "Scenario Outline|Scenario Template",
144 "then" => "*|Then",
145 "when" => "*|When",
146 },
147 'en-Scouse' => {
148 "and" => "*|An",
149 "background" => "Dis is what went down",
150 "but" => "*|Buh",
151 "examples" => "Examples",
152 "feature" => "Feature",
153 "given" => "*|Givun|Youse know when youse got",
154 "name" => "Scouse",
155 "native" => "Scouse",
156 "scenario" => "The thing of it is",
157 "outline" => "Wharrimean is",
158 "then" => "*|Dun|Den youse gotta",
159 "when" => "*|Wun|Youse know like when",
160 },
161 'en-au' => {
162 "and" => "*|N",
163 "background" => "Background",
164 "but" => "*|Cept",
165 "examples" => "Cobber",
166 "feature" => "Crikey",
167 "given" => "*|Ya know how",
168 "name" => "Australian",
169 "native" => "Australian",
170 "scenario" => "Mate",
171 "outline" => "Blokes",
172 "then" => "*|Ya gotta",
173 "when" => "*|When",
174 },
175 'en-lol' => {
176 "and" => "*|AN",
177 "background" => "B4",
178 "but" => "*|BUT",
179 "examples" => "EXAMPLZ",
180 "feature" => "OH HAI",
181 "given" => "*|I CAN HAZ",
182 "name" => "LOLCAT",
183 "native" => "LOLCAT",
184 "scenario" => "MISHUN",
185 "outline" => "MISHUN SRSLY",
186 "then" => "*|DEN",
187 "when" => "*|WEN",
188 },
189 'en-pirate' => {
190 "and" => "*|Aye",
191 "background" => "Yo-ho-ho",
192 "but" => "*|Avast!",
193 "examples" => "Dead men tell no tales",
194 "feature" => "Ahoy matey!",
195 "given" => "*|Gangway!",
196 "name" => "Pirate",
197 "native" => "Pirate",
198 "scenario" => "Heave to",
199 "outline" => "Shiver me timbers",
200 "then" => "*|Let go and haul",
201 "when" => "*|Blimey!",
202 },
203 'en-tx' => {
204 "and" => "*|And y'all",
205 "background" => "Background",
206 "but" => "*|But y'all",
207 "examples" => "Examples",
208 "feature" => "Feature",
209 "given" => "*|Given y'all",
210 "name" => "Texan",
211 "native" => "Texan",
212 "scenario" => "Scenario",
213 "outline" => "All y'all",
214 "then" => "*|Then y'all",
215 "when" => "*|When y'all",
216 },
217 'eo' => {
218 "and" => "*|Kaj",
219 "background" => "Fono",
220 "but" => "*|Sed",
221 "examples" => "Ekzemploj",
222 "feature" => "Trajto",
223 "given" => "*|Donitaĵo",
224 "name" => "Esperanto",
225 "native" => "Esperanto",
226 "scenario" => "Scenaro",
227 "outline" => "Konturo de la scenaro",
228 "then" => "*|Do",
229 "when" => "*|Se",
230 },
231 'es' => {
232 "and" => "*|Y",
233 "background" => "Antecedentes",
234 "but" => "*|Pero",
235 "examples" => "Ejemplos",
236 "feature" => "Característica",
237 "given" => "*|Dado",
238 "name" => "Spanish",
239 "native" => "español",
240 "scenario" => "Escenario",
241 "outline" => "Esquema del escenario",
242 "then" => "*|Entonces",
243 "when" => "*|Cuando",
244 },
245 'et' => {
246 "and" => "*|Ja",
247 "background" => "Taust",
248 "but" => "*|Kuid",
249 "examples" => "Juhtumid",
250 "feature" => "Omadus",
251 "given" => "*|Eeldades",
252 "name" => "Estonian",
253 "native" => "eesti keel",
254 "scenario" => "Stsenaarium",
255 "outline" => "Raamstsenaarium",
256 "then" => "*|Siis",
257 "when" => "*|Kui",
258 },
259 'fi' => {
260 "and" => "*|Ja",
261 "background" => "Tausta",
262 "but" => "*|Mutta",
263 "examples" => "Tapaukset",
264 "feature" => "Ominaisuus",
265 "given" => "*|Oletetaan",
266 "name" => "Finnish",
267 "native" => "suomi",
268 "scenario" => "Tapaus",
269 "outline" => "Tapausaihio",
270 "then" => "*|Niin",
271 "when" => "*|Kun",
272 },
273 'fr' => {
274 "and" => "*|Et",
275 "background" => "Contexte",
276 "but" => "*|Mais",
277 "examples" => "Exemples",
278 "feature" => "Fonctionnalité",
279 "given" => "*|Soit|Etant donné",
280 "name" => "French",
281 "native" => "français",
282 "scenario" => "Scénario",
283 "outline" => "Plan du scénario|Plan du Scénario",
284 "then" => "*|Alors",
285 "when" => "*|Quand|Lorsque|Lorsqu'<",
286 },
287 'he' => {
288 "and" => "*|וגם",
289 "background" => "רקע",
290 "but" => "*|אבל",
291 "examples" => "דוגמאות",
292 "feature" => "תכונה",
293 "given" => "*|בהינתן",
294 "name" => "Hebrew",
295 "native" => "עברית",
296 "scenario" => "תרחיש",
297 "outline" => "תבנית תרחיש",
298 "then" => "*|אז|אזי",
299 "when" => "*|כאשר",
300 },
301 'hr' => {
302 "and" => "*|I",
303 "background" => "Pozadina",
304 "but" => "*|Ali",
305 "examples" => "Primjeri|Scenariji",
306 "feature" => "Osobina|Mogućnost|Mogucnost",
307 "given" => "*|Zadan|Zadani|Zadano",
308 "name" => "Croatian",
309 "native" => "hrvatski",
310 "scenario" => "Scenarij",
311 "outline" => "Skica|Koncept",
312 "then" => "*|Onda",
313 "when" => "*|Kada|Kad",
314 },
315 'hu' => {
316 "and" => "*|És",
317 "background" => "Háttér",
318 "but" => "*|De",
319 "examples" => "Példák",
320 "feature" => "Jellemző",
321 "given" => "*|Amennyiben|Adott",
322 "name" => "Hungarian",
323 "native" => "magyar",
324 "scenario" => "Forgatókönyv",
325 "outline" => "Forgatókönyv vázlat",
326 "then" => "*|Akkor",
327 "when" => "*|Majd|Ha|Amikor",
328 },
329 'id' => {
330 "and" => "*|Dan",
331 "background" => "Dasar",
332 "but" => "*|Tapi",
333 "examples" => "Contoh",
334 "feature" => "Fitur",
335 "given" => "*|Dengan",
336 "name" => "Indonesian",
337 "native" => "Bahasa Indonesia",
338 "scenario" => "Skenario",
339 "outline" => "Skenario konsep",
340 "then" => "*|Maka",
341 "when" => "*|Ketika",
342 },
343 'it' => {
344 "and" => "*|E",
345 "background" => "Contesto",
346 "but" => "*|Ma",
347 "examples" => "Esempi",
348 "feature" => "Funzionalità",
349 "given" => "*|Dato",
350 "name" => "Italian",
351 "native" => "italiano",
352 "scenario" => "Scenario",
353 "outline" => "Schema dello scenario",
354 "then" => "*|Allora",
355 "when" => "*|Quando",
356 },
357 'ja' => {
358 "and" => "*|かつ<",
359 "background" => "背景",
360 "but" => "*|しかし<|但し<|ただし<",
361 "examples" => "例|サンプル",
362 "feature" => "フィーチャ|機能",
363 "given" => "*|前提<",
364 "name" => "Japanese",
365 "native" => "日本語",
366 "scenario" => "シナリオ",
367 "outline" => "シナリオアウトライン|シナリオテンプレート|テンプレ|シナリオテンプレ",
368 "then" => "*|ならば<",
369 "when" => "*|もし<",
370 },
371 'ko' => {
372 "and" => "*|그리고<",
373 "background" => "배경",
374 "but" => "*|하지만<|단<",
375 "examples" => "예",
376 "feature" => "기능",
377 "given" => "*|조건<|먼저<",
378 "name" => "Korean",
379 "native" => "한국어",
380 "scenario" => "시나리오",
381 "outline" => "시나리오 개요",
382 "then" => "*|그러면<",
383 "when" => "*|만일<|만약<",
384 },
385 'lt' => {
386 "and" => "*|Ir",
387 "background" => "Kontekstas",
388 "but" => "*|Bet",
389 "examples" => "Pavyzdžiai|Scenarijai|Variantai",
390 "feature" => "Savybė",
391 "given" => "*|Duota",
392 "name" => "Lithuanian",
393 "native" => "lietuvių kalba",
394 "scenario" => "Scenarijus",
395 "outline" => "Scenarijaus šablonas",
396 "then" => "*|Tada",
397 "when" => "*|Kai",
398 },
399 'lu' => {
400 "and" => "*|an|a",
401 "background" => "Hannergrond",
402 "but" => "*|awer|mä",
403 "examples" => "Beispiller",
404 "feature" => "Funktionalitéit",
405 "given" => "*|ugeholl",
406 "name" => "Luxemburgish",
407 "native" => "Lëtzebuergesch",
408 "scenario" => "Szenario",
409 "outline" => "Plang vum Szenario",
410 "then" => "*|dann",
411 "when" => "*|wann",
412 },
413 'lv' => {
414 "and" => "*|Un",
415 "background" => "Konteksts|Situācija",
416 "but" => "*|Bet",
417 "examples" => "Piemēri|Paraugs",
418 "feature" => "Funkcionalitāte|Fīča",
419 "given" => "*|Kad",
420 "name" => "Latvian",
421 "native" => "latviešu",
422 "scenario" => "Scenārijs",
423 "outline" => "Scenārijs pēc parauga",
424 "then" => "*|Tad",
425 "when" => "*|Ja",
426 },
427 'nl' => {
428 "and" => "*|En",
429 "background" => "Achtergrond",
430 "but" => "*|Maar",
431 "examples" => "Voorbeelden",
432 "feature" => "Functionaliteit",
433 "given" => "*|Gegeven|Stel",
434 "name" => "Dutch",
435 "native" => "Nederlands",
436 "scenario" => "Scenario",
437 "outline" => "Abstract Scenario",
438 "then" => "*|Dan",
439 "when" => "*|Als",
440 },
441 'no' => {
442 "and" => "*|Og",
443 "background" => "Bakgrunn",
444 "but" => "*|Men",
445 "examples" => "Eksempler",
446 "feature" => "Egenskap",
447 "given" => "*|Gitt",
448 "name" => "Norwegian",
449 "native" => "norsk",
450 "scenario" => "Scenario",
451 "outline" => "Scenariomal|Abstrakt Scenario",
452 "then" => "*|Så",
453 "when" => "*|Når",
454 },
455 'pl' => {
456 "and" => "*|Oraz|I",
457 "background" => "Założenia",
458 "but" => "*|Ale",
459 "examples" => "Przykłady",
460 "feature" => "Właściwość",
461 "given" => "*|Zakładając|Mając",
462 "name" => "Polish",
463 "native" => "polski",
464 "scenario" => "Scenariusz",
465 "outline" => "Szablon scenariusza",
466 "then" => "*|Wtedy",
467 "when" => "*|Jeżeli|Jeśli",
468 },
469 'pt' => {
470 "and" => "*|E",
471 "background" => "Contexto",
472 "but" => "*|Mas",
473 "examples" => "Exemplos",
474 "feature" => "Funcionalidade",
475 "given" => "*|Dado",
476 "name" => "Portuguese",
477 "native" => "português",
478 "scenario" => "Cenário|Cenario",
479 "outline" => "Esquema do Cenário|Esquema do Cenario",
480 "then" => "*|Então|Entao",
481 "when" => "*|Quando",
482 },
483 'ro' => {
484 "and" => "*|Si|Și|Şi",
485 "background" => "Context",
486 "but" => "*|Dar",
487 "examples" => "Exemple",
488 "feature" => "Functionalitate|Funcționalitate|Funcţionalitate",
489 "given" => "*|Date fiind|Dat fiind|Dati fiind|Dați fiind|Daţi fiind",
490 "name" => "Romanian",
491 "native" => "română",
492 "scenario" => "Scenariu",
493 "outline" => "Structura scenariu|Structură scenariu",
494 "then" => "*|Atunci",
495 "when" => "*|Cand|Când",
496 },
497 'ru' => {
498 "and" => "*|И|К тому же",
499 "background" => "Предыстория|Контекст",
500 "but" => "*|Но|А",
501 "examples" => "Примеры",
502 "feature" => "Функция|Функционал|Свойство",
503 "given" => "*|Допустим|Дано|Пусть",
504 "name" => "Russian",
505 "native" => "русский",
506 "scenario" => "Сценарий",
507 "outline" => "Структура сценария",
508 "then" => "*|То|Тогда",
509 "when" => "*|Если|Когда",
510 },
511 'sk' => {
512 "and" => "*|A",
513 "background" => "Pozadie",
514 "but" => "*|Ale",
515 "examples" => "Príklady",
516 "feature" => "Požiadavka",
517 "given" => "*|Pokiaľ",
518 "name" => "Slovak",
519 "native" => "Slovensky",
520 "scenario" => "Scenár",
521 "outline" => "Náčrt Scenáru",
522 "then" => "*|Tak",
523 "when" => "*|Keď",
524 },
525 'sr-Cyrl' => {
526 "and" => "*|И",
527 "background" => "Контекст|Основа|Позадина",
528 "but" => "*|Али",
529 "examples" => "Примери|Сценарији",
530 "feature" => "Функционалност|Могућност|Особина",
531 "given" => "*|Задато|Задате|Задати",
532 "name" => "Serbian",
533 "native" => "Српски",
534 "scenario" => "Сценарио|Пример",
535 "outline" => "Структура сценарија|Скица|Концепт",
536 "then" => "*|Онда",
537 "when" => "*|Када|Кад",
538 },
539 'sr-Latn' => {
540 "and" => "*|I",
541 "background" => "Kontekst|Osnova|Pozadina",
542 "but" => "*|Ali",
543 "examples" => "Primeri|Scenariji",
544 "feature" => "Funkcionalnost|Mogućnost|Mogucnost|Osobina",
545 "given" => "*|Zadato|Zadate|Zatati",
546 "name" => "Serbian (Latin)",
547 "native" => "Srpski (Latinica)",
548 "scenario" => "Scenario|Primer",
549 "outline" => "Struktura scenarija|Skica|Koncept",
550 "then" => "*|Onda",
551 "when" => "*|Kada|Kad",
552 },
553 'sv' => {
554 "and" => "*|Och",
555 "background" => "Bakgrund",
556 "but" => "*|Men",
557 "examples" => "Exempel",
558 "feature" => "Egenskap",
559 "given" => "*|Givet",
560 "name" => "Swedish",
561 "native" => "Svenska",
562 "scenario" => "Scenario",
563 "outline" => "Abstrakt Scenario|Scenariomall",
564 "then" => "*|Så",
565 "when" => "*|När",
566 },
567 'tr' => {
568 "and" => "*|Ve",
569 "background" => "Geçmiş",
570 "but" => "*|Fakat|Ama",
571 "examples" => "Örnekler",
572 "feature" => "Özellik",
573 "given" => "*|Diyelim ki",
574 "name" => "Turkish",
575 "native" => "Türkçe",
576 "scenario" => "Senaryo",
577 "outline" => "Senaryo taslağı",
578 "then" => "*|O zaman",
579 "when" => "*|Eğer ki",
580 },
581 'uk' => {
582 "and" => "*|І|А також|Та",
583 "background" => "Передумова",
584 "but" => "*|Але",
585 "examples" => "Приклади",
586 "feature" => "Функціонал",
587 "given" => "*|Припустимо|Припустимо, що|Нехай|Дано",
588 "name" => "Ukrainian",
589 "native" => "Українська",
590 "scenario" => "Сценарій",
591 "outline" => "Структура сценарію",
592 "then" => "*|То|Тоді",
593 "when" => "*|Якщо|Коли",
594 },
595 'uz' => {
596 "and" => "*|Ва",
597 "background" => "Тарих",
598 "but" => "*|Лекин|Бирок|Аммо",
599 "examples" => "Мисоллар",
600 "feature" => "Функционал",
601 "given" => "*|Агар",
602 "name" => "Uzbek",
603 "native" => "Узбекча",
604 "scenario" => "Сценарий",
605 "outline" => "Сценарий структураси",
606 "then" => "*|Унда",
607 "when" => "*|Агар",
608 },
609 'vi' => {
610 "and" => "*|Và",
611 "background" => "Bối cảnh",
612 "but" => "*|Nhưng",
613 "examples" => "Dữ liệu",
614 "feature" => "Tính năng",
615 "given" => "*|Biết|Cho",
616 "name" => "Vietnamese",
617 "native" => "Tiếng Việt",
618 "scenario" => "Tình huống|Kịch bản",
619 "outline" => "Khung tình huống|Khung kịch bản",
620 "then" => "*|Thì",
621 "when" => "*|Khi",
622 },
623 'zh-CN' => {
624 "and" => "*|而且<",
625 "background" => "背景",
626 "but" => "*|但是<",
627 "examples" => "例子",
628 "feature" => "功能",
629 "given" => "*|假如<",
630 "name" => "Chinese simplified",
631 "native" => "简体中文",
632 "scenario" => "场景",
633 "outline" => "场景大纲",
634 "then" => "*|那么<",
635 "when" => "*|当<",
636 },
637 'zh-TW' => {
638 "and" => "*|而且<|並且<",
639 "background" => "背景",
640 "but" => "*|但是<",
641 "examples" => "例子",
642 "feature" => "功能",
643 "given" => "*|假設<",
644 "name" => "Chinese traditional",
645 "native" => "繁體中文",
646 "scenario" => "場景|劇本",
647 "outline" => "場景大綱|劇本大綱",
648 "then" => "*|那麼<",
649 "when" => "*|當<",
650 },
651 };
652  
653 3 my $keywdot = q{^ \s* ( <KEYWORD> : .*?) \s* $};
654 3 my $step = q{^ \s* ( <KEYWORD> ) \s* (.*?) \s* $};
655  
656 3 my %PATTERNS = (
657 empty => q{^\s*$},
658 pragma => q{^\s*#(?:\s*(\w+\s*:\s*\w+))+},
659 comment => q{^\s*#},
660 tag => q{@\w+},
661 any => q{^\s*(.*?)\s*$},
662 feature => $keywdot,
663 background => $keywdot,
664 scenario => $keywdot,
665 outline => $keywdot,
666 examples => $keywdot,
667 given => $step,
668 when => $step,
669 then => $step,
670 and => $step,
671 but => $step,
672 trow => q{^\s*\|(.*?)\|\s*$},
673 text_quote => q{^\s*(""")\s*$},
674 );
675  
676 10 ▶sub patterns {
Subroutine patterns: called CC=4 SCAR=13.9
Pod documented
677 10 my ($self, $lang) = @_;
678 10 my $regexps;
679
680 10 my %translations = %{ $translations->{$lang} };
681
682 10 foreach my $key ( keys %PATTERNS ) {
683
684 170 my $pattern = $PATTERNS{$key};
685
686 170 ▶ if ( exists $translations{$key} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $translations{$key}) { } 100 70 170
687 # translate
688 100 my @keywords = split /\|/, $translations{$key};
689 100 foreach (@keywords) {
690 219 my $regexp = $pattern;
691 219 my $replace = quotemeta;
692 219 $regexp =~ s/<KEYWORD>/$replace/;
693 219 push @{ $regexps->{$key} }, qr{$regexp}ix;
694 }
695 }
696 else {
697 70 push @{ $regexps->{$key} }, qr{$pattern}i;
698 }
699
700 }
701
702 10 return $regexps;
703 }
704  
705 1 ▶sub languages {
Subroutine languages: called CC=1 SCAR=0.0
Pod undocumented
706 return [
707 1 sort map { "$_ => $translations->{$_}->{name} ($translations->{$_}->{native})" } ( keys %$translations )
708 ];
709 }
710  
711 1 ▶sub language_info {
Subroutine language_info: called CC=3 SCAR=11.0
Pod undocumented
712 1 my ($self, $lang) = @_;
713 1 ▶ $lang ||= 'en';
Condition50%1/2
$lang ||= "en"
l!l
10
MC/DC0%0/1
$lang ||= "en"
$lang
Truth table50%1/2
A
A= $lang
Aresult
11
00
714
715 1 my $translation = $translations->{$lang};
716 1 my @result;
717
718 1 for ( qw{feature background scenario outline examples given when then and but} ) {
719 10 my $translated = '"' . join( '", "', ( split /\|/, $translation->{$_} ) ) . '"';
720 10 push @result, [$_, $translated ];
721 }
722 1 return [@result];
723 }
724  
725 =head1 AUTHOR
726  
727 Andrei V. Toutoukine, C<< <tut at isuct.ru> >>
728  
729 =head1 BUGS
730  
731 Please report any bugs or feature requests to C<bug-/home/tut/bin/src/test-pcuke-gherkin at rt.cpan.org>, or through
732 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=/home/tut/bin/src/Test-Pcuke-Gherkin>. I will be notified, and then you'll
733 automatically be notified of progress on your bug as I make changes.
734  
735  
736  
737  
738 =head1 SUPPORT
739  
740 You can find documentation for this module with the perldoc command.
741  
742 perldoc Test::Pcuke::Gherkin::I18n
743  
744  
745 You can also look for information at:
746  
747 =over 4
748  
749 =item * RT: CPAN's request tracker
750  
751 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=/home/tut/bin/src/Test-Pcuke-Gherkin>
752  
753 =item * AnnoCPAN: Annotated CPAN documentation
754  
755 L<http://annocpan.org/dist//home/tut/bin/src/Test-Pcuke-Gherkin>
756  
757 =item * CPAN Ratings
758  
759 L<http://cpanratings.perl.org/d//home/tut/bin/src/Test-Pcuke-Gherkin>
760  
761 =item * Search CPAN
762  
763 L<http://search.cpan.org/dist//home/tut/bin/src/Test-Pcuke-Gherkin/>
764  
765 =back
766  
767  
768 =head1 ACKNOWLEDGEMENTS
769  
770 The essential part of this file is borrowed from the original
771 cucumber-gherkin project L<https://github.com/cucumber/gherkin>,
772 lib/gherkin/i18n.yml
773  
774 The origiginal license of the cucumber-gherkin project follows:
775  
776 =head1 LICENSE AND COPYRIGHT
777  
778 Copyright (c) 2009-2011 Mike Sassak, Gregory Hnatiuk, Aslak Hellesøy
779  
780 Permission is hereby granted, free of charge, to any person obtaining
781 a copy of this software and associated documentation files (the
782 "Software"), to deal in the Software without restriction, including
783 without limitation the rights to use, copy, modify, merge, publish,
784 distribute, sublicense, and/or sell copies of the Software, and to
785 permit persons to whom the Software is furnished to do so, subject to
786 the following conditions:
787  
788 The above copyright notice and this permission notice shall be
789 included in all copies or substantial portions of the Software.
790  
791 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
792 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
793 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
794 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
795 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
796 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
797 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
798  
799  
800 =cut
801  
802 3 1; # End of Test::Pcuke::Gherkin::I18n
« Gherkin/Node/Step.pm ↑ Summary Gherkin/Node/Table.pm »