How to use language method in storybook-root

Best JavaScript code snippet using storybook-root

languages.js

Source:languages.js Github

copy

Full Screen

...28 module.exports = language;29 }30 // Browser31 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {32 this.numeral.language('be-nl', language);33 }34}());35/*! 36 * numeral.js language configuration37 * language : simplified chinese38 * author : badplum : https://github.com/badplum39 */40(function () {41 var language = {42 delimiters: {43 thousands: ',',44 decimal: '.'45 },46 abbreviations: {47 thousand: '千',48 million: '百万',49 billion: '十亿',50 trillion: '兆'51 },52 ordinal: function (number) {53 return '.';54 },55 currency: {56 symbol: '¥'57 }58 };5960 // Node61 if (typeof module !== 'undefined' && module.exports) {62 module.exports = language;63 }64 // Browser65 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {66 this.numeral.language('chs', language);67 }68}());69/*!70 * numeral.js language configuration71 * language : czech (cs)72 * author : Anatoli Papirovski : https://github.com/apapirovski73 */74(function () {75 var language = {76 delimiters: {77 thousands: ' ',78 decimal: ','79 },80 abbreviations: {81 thousand: 'tis.',82 million: 'mil.',83 billion: 'b',84 trillion: 't'85 },86 ordinal: function () {87 return '.';88 },89 currency: {90 symbol: 'Kč'91 }92 };93 // Node94 if (typeof module !== 'undefined' && module.exports) {95 module.exports = language;96 }97 // Browser98 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {99 this.numeral.language('cs', language);100 }101}());102/*! 103 * numeral.js language configuration104 * language : danish denmark (dk)105 * author : Michael Storgaard : https://github.com/mstorgaard106 */107(function () {108 var language = {109 delimiters: {110 thousands: '.',111 decimal: ','112 },113 abbreviations: {114 thousand: 'k',115 million: 'mio',116 billion: 'mia',117 trillion: 'b'118 },119 ordinal: function (number) {120 return '.';121 },122 currency: {123 symbol: 'DKK'124 }125 };126 // Node127 if (typeof module !== 'undefined' && module.exports) {128 module.exports = language;129 }130 // Browser131 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {132 this.numeral.language('da-dk', language);133 }134}());135/*! 136 * numeral.js language configuration137 * language : German in Switzerland (de-ch)138 * author : Michael Piefel : https://github.com/piefel (based on work from Marco Krage : https://github.com/sinky)139 */ 140(function () {141 var language = {142 delimiters: {143 thousands: ' ',144 decimal: ','145 },146 abbreviations: {147 thousand: 'k',148 million: 'm',149 billion: 'b',150 trillion: 't'151 },152 ordinal: function (number) {153 return '.';154 },155 currency: {156 symbol: 'CHF'157 }158 };159 // Node160 if (typeof module !== 'undefined' && module.exports) {161 module.exports = language;162 }163 // Browser164 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {165 this.numeral.language('de-ch', language);166 }167}());168/*! 169 * numeral.js language configuration170 * language : German (de) – generally useful in Germany, Austria, Luxembourg, Belgium171 * author : Marco Krage : https://github.com/sinky172 */173(function () {174 var language = {175 delimiters: {176 thousands: ' ',177 decimal: ','178 },179 abbreviations: {180 thousand: 'k',181 million: 'm',182 billion: 'b',183 trillion: 't'184 },185 ordinal: function (number) {186 return '.';187 },188 currency: {189 symbol: '€'190 }191 };192 // Node193 if (typeof module !== 'undefined' && module.exports) {194 module.exports = language;195 }196 // Browser197 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {198 this.numeral.language('de', language);199 }200}());201/*! 202 * numeral.js language configuration203 * language : english united kingdom (uk)204 * author : Dan Ristic : https://github.com/dristic205 */206(function () {207 var language = {208 delimiters: {209 thousands: ',',210 decimal: '.'211 },212 abbreviations: {213 thousand: 'k',214 million: 'm',215 billion: 'b',216 trillion: 't'217 },218 ordinal: function (number) {219 var b = number % 10;220 return (~~ (number % 100 / 10) === 1) ? 'th' :221 (b === 1) ? 'st' :222 (b === 2) ? 'nd' :223 (b === 3) ? 'rd' : 'th';224 },225 currency: {226 symbol: '£'227 }228 };229 // Node230 if (typeof module !== 'undefined' && module.exports) {231 module.exports = language;232 }233 // Browser234 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {235 this.numeral.language('en-gb', language);236 }237}());238/*! 239 * numeral.js language configuration240 * language : spanish Spain241 * author : Hernan Garcia : https://github.com/hgarcia242 */243(function () {244 var language = {245 delimiters: {246 thousands: '.',247 decimal: ','248 },249 abbreviations: {250 thousand: 'k',251 million: 'mm',252 billion: 'b',253 trillion: 't'254 },255 ordinal: function (number) {256 var b = number % 10;257 return (b === 1 || b === 3) ? 'er' :258 (b === 2) ? 'do' :259 (b === 7 || b === 0) ? 'mo' :260 (b === 8) ? 'vo' :261 (b === 9) ? 'no' : 'to';262 },263 currency: {264 symbol: '€'265 }266 };267 // Node268 if (typeof module !== 'undefined' && module.exports) {269 module.exports = language;270 }271 // Browser272 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {273 this.numeral.language('es', language);274 }275}());276/*! 277 * numeral.js language configuration278 * language : spanish279 * author : Hernan Garcia : https://github.com/hgarcia280 */281(function () {282 var language = {283 delimiters: {284 thousands: '.',285 decimal: ','286 },287 abbreviations: {288 thousand: 'k',289 million: 'mm',290 billion: 'b',291 trillion: 't'292 },293 ordinal: function (number) {294 var b = number % 10;295 return (b === 1 || b === 3) ? 'er' :296 (b === 2) ? 'do' :297 (b === 7 || b === 0) ? 'mo' : 298 (b === 8) ? 'vo' :299 (b === 9) ? 'no' : 'to';300 },301 currency: {302 symbol: '$'303 }304 };305 // Node306 if (typeof module !== 'undefined' && module.exports) {307 module.exports = language;308 }309 // Browser310 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {311 this.numeral.language('es', language);312 }313}());314/*! 315 * numeral.js language configuration316 * language : Estonian317 * author : Illimar Tambek : https://github.com/ragulka318 *319 * Note: in Estonian, abbreviations are always separated320 * from numbers with a space321 */322(function () {323 var language = {324 delimiters: {325 thousands: ' ',326 decimal: ','327 },328 abbreviations: {329 thousand: ' tuh',330 million: ' mln',331 billion: ' mld',332 trillion: ' trl'333 },334 ordinal: function (number) {335 return '.';336 },337 currency: {338 symbol: '€'339 }340 };341 // Node342 if (typeof module !== 'undefined' && module.exports) {343 module.exports = language;344 }345 // Browser346 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {347 this.numeral.language('et', language);348 }349}());350/*! 351 * numeral.js language configuration352 * language : Finnish353 * author : Sami Saada : https://github.com/samitheberber354 */355(function () {356 var language = {357 delimiters: {358 thousands: ' ',359 decimal: ','360 },361 abbreviations: {362 thousand: 'k',363 million: 'M',364 billion: 'G',365 trillion: 'T'366 },367 ordinal: function (number) {368 return '.';369 },370 currency: {371 symbol: '€'372 }373 };374 // Node375 if (typeof module !== 'undefined' && module.exports) {376 module.exports = language;377 }378 // Browser379 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {380 this.numeral.language('fi', language);381 }382}());383/*!384 * numeral.js language configuration385 * language : french (Canada) (fr-CA)386 * author : Léo Renaud-Allaire : https://github.com/renaudleo387 */388(function () {389 var language = {390 delimiters: {391 thousands: ' ',392 decimal: ','393 },394 abbreviations: {395 thousand: 'k',396 million: 'M',397 billion: 'G',398 trillion: 'T'399 },400 ordinal : function (number) {401 return number === 1 ? 'er' : 'e';402 },403 currency: {404 symbol: '$'405 }406 };407 // Node408 if (typeof module !== 'undefined' && module.exports) {409 module.exports = language;410 }411 // Browser412 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {413 this.numeral.language('fr-CA', language);414 }415}());416/*! 417 * numeral.js language configuration418 * language : french (fr-ch)419 * author : Adam Draper : https://github.com/adamwdraper420 */421(function () {422 var language = {423 delimiters: {424 thousands: '\'',425 decimal: '.'426 },427 abbreviations: {428 thousand: 'k',429 million: 'm',430 billion: 'b',431 trillion: 't'432 },433 ordinal : function (number) {434 return number === 1 ? 'er' : 'e';435 },436 currency: {437 symbol: 'CHF'438 }439 };440 // Node441 if (typeof module !== 'undefined' && module.exports) {442 module.exports = language;443 }444 // Browser445 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {446 this.numeral.language('fr-ch', language);447 }448}());449/*! 450 * numeral.js language configuration451 * language : french (fr)452 * author : Adam Draper : https://github.com/adamwdraper453 */454(function () {455 var language = {456 delimiters: {457 thousands: ' ',458 decimal: ','459 },460 abbreviations: {461 thousand: 'k',462 million: 'm',463 billion: 'b',464 trillion: 't'465 },466 ordinal : function (number) {467 return number === 1 ? 'er' : 'e';468 },469 currency: {470 symbol: '€'471 }472 };473 // Node474 if (typeof module !== 'undefined' && module.exports) {475 module.exports = language;476 }477 // Browser478 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {479 this.numeral.language('fr', language);480 }481}());482/*!483 * numeral.js language configuration484 * language : Hungarian (hu)485 * author : Peter Bakondy : https://github.com/pbakondy486 */487(function () {488 var language = {489 delimiters: {490 thousands: ' ',491 decimal: ','492 },493 abbreviations: {494 thousand: 'E', // ezer495 million: 'M', // millió496 billion: 'Mrd', // milliárd497 trillion: 'T' // trillió498 },499 ordinal: function (number) {500 return '.';501 },502 currency: {503 symbol: ' Ft'504 }505 };506 // Node507 if (typeof module !== 'undefined' && module.exports) {508 module.exports = language;509 }510 // Browser511 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {512 this.numeral.language('hu', language);513 }514}());515/*! 516 * numeral.js language configuration517 * language : italian Italy (it)518 * author : Giacomo Trombi : http://cinquepunti.it519 */520(function () {521 var language = {522 delimiters: {523 thousands: '.',524 decimal: ','525 },526 abbreviations: {527 thousand: 'mila',528 million: 'mil',529 billion: 'b',530 trillion: 't'531 },532 ordinal: function (number) {533 return 'º';534 },535 currency: {536 symbol: '€'537 }538 };539 // Node540 if (typeof module !== 'undefined' && module.exports) {541 module.exports = language;542 }543 // Browser544 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {545 this.numeral.language('it', language);546 }547}());548/*! 549 * numeral.js language configuration550 * language : japanese551 * author : teppeis : https://github.com/teppeis552 */553(function () {554 var language = {555 delimiters: {556 thousands: ',',557 decimal: '.'558 },559 abbreviations: {560 thousand: '千',561 million: '百万',562 billion: '十億',563 trillion: '兆'564 },565 ordinal: function (number) {566 return '.';567 },568 currency: {569 symbol: '¥'570 }571 };572 // Node573 if (typeof module !== 'undefined' && module.exports) {574 module.exports = language;575 }576 // Browser577 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {578 this.numeral.language('ja', language);579 }580}());581/*! 582 * numeral.js language configuration583 * language : netherlands-dutch (nl-nl)584 * author : Dave Clayton : https://github.com/davedx585 */586(function () {587 var language = {588 delimiters: {589 thousands: '.',590 decimal : ','591 },592 abbreviations: {593 thousand : 'k',594 million : 'mln',595 billion : 'mrd',596 trillion : 'bln'597 },598 ordinal : function (number) {599 var remainder = number % 100;600 return (number !== 0 && remainder <= 1 || remainder === 8 || remainder >= 20) ? 'ste' : 'de';601 },602 currency: {603 symbol: '€ '604 }605 };606 // Node607 if (typeof module !== 'undefined' && module.exports) {608 module.exports = language;609 }610 // Browser611 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {612 this.numeral.language('nl-nl', language);613 }614}());615/*! 616 * numeral.js language configuration617 * language : polish (pl)618 * author : Dominik Bulaj : https://github.com/dominikbulaj619 */620(function () {621 var language = {622 delimiters: {623 thousands: ' ',624 decimal: ','625 },626 abbreviations: {627 thousand: 'tys.',628 million: 'mln',629 billion: 'mld',630 trillion: 'bln'631 },632 ordinal: function (number) {633 return '.';634 },635 currency: {636 symbol: 'PLN'637 }638 };639 // Node640 if (typeof module !== 'undefined' && module.exports) {641 module.exports = language;642 }643 // Browser644 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {645 this.numeral.language('pl', language);646 }647}());648/*! 649 * numeral.js language configuration650 * language : portuguese brazil (pt-br)651 * author : Ramiro Varandas Jr : https://github.com/ramirovjr652 */653(function () {654 var language = {655 delimiters: {656 thousands: '.',657 decimal: ','658 },659 abbreviations: {660 thousand: 'mil',661 million: 'milhões',662 billion: 'b',663 trillion: 't'664 },665 ordinal: function (number) {666 return 'º';667 },668 currency: {669 symbol: 'R$'670 }671 };672 // Node673 if (typeof module !== 'undefined' && module.exports) {674 module.exports = language;675 }676 // Browser677 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {678 this.numeral.language('pt-br', language);679 }680}());681/*! 682 * numeral.js language configuration683 * language : portuguese (pt-pt)684 * author : Diogo Resende : https://github.com/dresende685 */686(function () {687 var language = {688 delimiters: {689 thousands: ' ',690 decimal: ','691 },692 abbreviations: {693 thousand: 'k',694 million: 'm',695 billion: 'b',696 trillion: 't'697 },698 ordinal : function (number) {699 return 'º';700 },701 currency: {702 symbol: '€'703 }704 };705 // Node706 if (typeof module !== 'undefined' && module.exports) {707 module.exports = language;708 }709 // Browser710 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {711 this.numeral.language('pt-pt', language);712 }713}());714// numeral.js language configuration715// language : Russian for the Ukraine (ru-UA)716// author : Anatoli Papirovski : https://github.com/apapirovski717(function () {718 var language = {719 delimiters: {720 thousands: ' ',721 decimal: ','722 },723 abbreviations: {724 thousand: 'тыс.',725 million: 'млн',726 billion: 'b',727 trillion: 't'728 },729 ordinal: function () {730 // not ideal, but since in Russian it can taken on 731 // different forms (masculine, feminine, neuter)732 // this is all we can do733 return '.'; 734 },735 currency: {736 symbol: '\u20B4'737 }738 };739 // Node740 if (typeof module !== 'undefined' && module.exports) {741 module.exports = language;742 }743 // Browser744 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {745 this.numeral.language('ru-UA', language);746 }747}());748/*! 749 * numeral.js language configuration750 * language : russian (ru)751 * author : Anatoli Papirovski : https://github.com/apapirovski752 */753(function () {754 var language = {755 delimiters: {756 thousands: ' ',757 decimal: ','758 },759 abbreviations: {760 thousand: 'тыс.',761 million: 'млн',762 billion: 'b',763 trillion: 't'764 },765 ordinal: function () {766 // not ideal, but since in Russian it can taken on 767 // different forms (masculine, feminine, neuter)768 // this is all we can do769 return '.'; 770 },771 currency: {772 symbol: 'руб.'773 }774 };775 // Node776 if (typeof module !== 'undefined' && module.exports) {777 module.exports = language;778 }779 // Browser780 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {781 this.numeral.language('ru', language);782 }783}());784/*!785 * numeral.js language configuration786 * language : slovak (sk)787 * author : Ahmed Al Hafoudh : http://www.freevision.sk788 */789(function () {790 var language = {791 delimiters: {792 thousands: ' ',793 decimal: ','794 },795 abbreviations: {796 thousand: 'tis.',797 million: 'mil.',798 billion: 'b',799 trillion: 't'800 },801 ordinal: function () {802 return '.';803 },804 currency: {805 symbol: '€'806 }807 };808 // Node809 if (typeof module !== 'undefined' && module.exports) {810 module.exports = language;811 }812 // Browser813 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {814 this.numeral.language('sk', language);815 }816}());817/*! 818 * numeral.js language configuration819 * language : thai (th)820 * author : Sathit Jittanupat : https://github.com/jojosati821 */822(function () {823 var language = {824 delimiters: {825 thousands: ',',826 decimal: '.'827 },828 abbreviations: {829 thousand: 'พัน',830 million: 'ล้าน',831 billion: 'พันล้าน',832 trillion: 'ล้านล้าน'833 },834 ordinal: function (number) {835 return '.';836 },837 currency: {838 symbol: '฿'839 }840 };841 // Node842 if (typeof module !== 'undefined' && module.exports) {843 module.exports = language;844 }845 // Browser846 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {847 this.numeral.language('th', language);848 }849}());850/*! 851 * numeral.js language configuration852 * language : turkish (tr)853 * author : Ecmel Ercan : https://github.com/ecmel, Erhan Gundogan : https://github.com/erhangundogan, Burak Yiğit Kaya: https://github.com/BYK854 */855(function () {856 var suffixes = {857 1: '\'inci',858 5: '\'inci',859 8: '\'inci',860 70: '\'inci',861 80: '\'inci',862 2: '\'nci',863 7: '\'nci',864 20: '\'nci',865 50: '\'nci',866 3: '\'üncü',867 4: '\'üncü',868 100: '\'üncü',869 6: '\'ncı',870 9: '\'uncu',871 10: '\'uncu',872 30: '\'uncu',873 60: '\'ıncı',874 90: '\'ıncı'875 },876 language = {877 delimiters: {878 thousands: '.',879 decimal: ','880 },881 abbreviations: {882 thousand: 'bin',883 million: 'milyon',884 billion: 'milyar',885 trillion: 'trilyon'886 },887 ordinal: function (number) {888 if (number === 0) { // special case for zero889 return '\'ıncı';890 }891 var a = number % 10,892 b = number % 100 - a,893 c = number >= 100 ? 100 : null;894 return suffixes[a] || suffixes[b] || suffixes[c];895 },896 currency: {897 symbol: '\u20BA'898 }899 };900 // Node901 if (typeof module !== 'undefined' && module.exports) {902 module.exports = language;903 }904 // Browser905 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {906 this.numeral.language('tr', language);907 }908}());909// numeral.js language configuration910// language : Ukrainian for the Ukraine (uk-UA)911// author : Michael Piefel : https://github.com/piefel (with help from Tetyana Kuzmenko)912(function () {913 var language = {914 delimiters: {915 thousands: ' ',916 decimal: ','917 },918 abbreviations: {919 thousand: 'тис.',920 million: 'млн',921 billion: 'млрд',922 trillion: 'блн'923 },924 ordinal: function () {925 // not ideal, but since in Ukrainian it can taken on 926 // different forms (masculine, feminine, neuter)927 // this is all we can do928 return ''; 929 },930 currency: {931 symbol: '\u20B4'932 }933 };934 // Node935 if (typeof module !== 'undefined' && module.exports) {936 module.exports = language;937 }938 // Browser939 if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {940 this.numeral.language('uk-UA', language);941 }...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1var hljs = require('./highlight');2hljs.registerLanguage('1c', require('./languages/1c'));3hljs.registerLanguage('abnf', require('./languages/abnf'));4hljs.registerLanguage('accesslog', require('./languages/accesslog'));5hljs.registerLanguage('actionscript', require('./languages/actionscript'));6hljs.registerLanguage('ada', require('./languages/ada'));7hljs.registerLanguage('apache', require('./languages/apache'));8hljs.registerLanguage('applescript', require('./languages/applescript'));9hljs.registerLanguage('cpp', require('./languages/cpp'));10hljs.registerLanguage('arduino', require('./languages/arduino'));11hljs.registerLanguage('armasm', require('./languages/armasm'));12hljs.registerLanguage('xml', require('./languages/xml'));13hljs.registerLanguage('asciidoc', require('./languages/asciidoc'));14hljs.registerLanguage('aspectj', require('./languages/aspectj'));15hljs.registerLanguage('autohotkey', require('./languages/autohotkey'));16hljs.registerLanguage('autoit', require('./languages/autoit'));17hljs.registerLanguage('avrasm', require('./languages/avrasm'));18hljs.registerLanguage('awk', require('./languages/awk'));19hljs.registerLanguage('axapta', require('./languages/axapta'));20hljs.registerLanguage('bash', require('./languages/bash'));21hljs.registerLanguage('basic', require('./languages/basic'));22hljs.registerLanguage('bnf', require('./languages/bnf'));23hljs.registerLanguage('brainfuck', require('./languages/brainfuck'));24hljs.registerLanguage('cal', require('./languages/cal'));25hljs.registerLanguage('capnproto', require('./languages/capnproto'));26hljs.registerLanguage('ceylon', require('./languages/ceylon'));27hljs.registerLanguage('clojure', require('./languages/clojure'));28hljs.registerLanguage('clojure-repl', require('./languages/clojure-repl'));29hljs.registerLanguage('cmake', require('./languages/cmake'));30hljs.registerLanguage('coffeescript', require('./languages/coffeescript'));31hljs.registerLanguage('coq', require('./languages/coq'));32hljs.registerLanguage('cos', require('./languages/cos'));33hljs.registerLanguage('crmsh', require('./languages/crmsh'));34hljs.registerLanguage('crystal', require('./languages/crystal'));35hljs.registerLanguage('cs', require('./languages/cs'));36hljs.registerLanguage('csp', require('./languages/csp'));37hljs.registerLanguage('css', require('./languages/css'));38hljs.registerLanguage('d', require('./languages/d'));39hljs.registerLanguage('markdown', require('./languages/markdown'));40hljs.registerLanguage('dart', require('./languages/dart'));41hljs.registerLanguage('delphi', require('./languages/delphi'));42hljs.registerLanguage('diff', require('./languages/diff'));43hljs.registerLanguage('django', require('./languages/django'));44hljs.registerLanguage('dns', require('./languages/dns'));45hljs.registerLanguage('dockerfile', require('./languages/dockerfile'));46hljs.registerLanguage('dos', require('./languages/dos'));47hljs.registerLanguage('dsconfig', require('./languages/dsconfig'));48hljs.registerLanguage('dts', require('./languages/dts'));49hljs.registerLanguage('dust', require('./languages/dust'));50hljs.registerLanguage('ebnf', require('./languages/ebnf'));51hljs.registerLanguage('elixir', require('./languages/elixir'));52hljs.registerLanguage('elm', require('./languages/elm'));53hljs.registerLanguage('ruby', require('./languages/ruby'));54hljs.registerLanguage('erb', require('./languages/erb'));55hljs.registerLanguage('erlang-repl', require('./languages/erlang-repl'));56hljs.registerLanguage('erlang', require('./languages/erlang'));57hljs.registerLanguage('excel', require('./languages/excel'));58hljs.registerLanguage('fix', require('./languages/fix'));59hljs.registerLanguage('fortran', require('./languages/fortran'));60hljs.registerLanguage('fsharp', require('./languages/fsharp'));61hljs.registerLanguage('gams', require('./languages/gams'));62hljs.registerLanguage('gauss', require('./languages/gauss'));63hljs.registerLanguage('gcode', require('./languages/gcode'));64hljs.registerLanguage('gherkin', require('./languages/gherkin'));65hljs.registerLanguage('glsl', require('./languages/glsl'));66hljs.registerLanguage('go', require('./languages/go'));67hljs.registerLanguage('golo', require('./languages/golo'));68hljs.registerLanguage('gradle', require('./languages/gradle'));69hljs.registerLanguage('groovy', require('./languages/groovy'));70hljs.registerLanguage('haml', require('./languages/haml'));71hljs.registerLanguage('handlebars', require('./languages/handlebars'));72hljs.registerLanguage('haskell', require('./languages/haskell'));73hljs.registerLanguage('haxe', require('./languages/haxe'));74hljs.registerLanguage('hsp', require('./languages/hsp'));75hljs.registerLanguage('htmlbars', require('./languages/htmlbars'));76hljs.registerLanguage('http', require('./languages/http'));77hljs.registerLanguage('inform7', require('./languages/inform7'));78hljs.registerLanguage('ini', require('./languages/ini'));79hljs.registerLanguage('irpf90', require('./languages/irpf90'));80hljs.registerLanguage('java', require('./languages/java'));81hljs.registerLanguage('javascript', require('./languages/javascript'));82hljs.registerLanguage('json', require('./languages/json'));83hljs.registerLanguage('julia', require('./languages/julia'));84hljs.registerLanguage('kotlin', require('./languages/kotlin'));85hljs.registerLanguage('lasso', require('./languages/lasso'));86hljs.registerLanguage('ldif', require('./languages/ldif'));87hljs.registerLanguage('less', require('./languages/less'));88hljs.registerLanguage('lisp', require('./languages/lisp'));89hljs.registerLanguage('livecodeserver', require('./languages/livecodeserver'));90hljs.registerLanguage('livescript', require('./languages/livescript'));91hljs.registerLanguage('lsl', require('./languages/lsl'));92hljs.registerLanguage('lua', require('./languages/lua'));93hljs.registerLanguage('makefile', require('./languages/makefile'));94hljs.registerLanguage('mathematica', require('./languages/mathematica'));95hljs.registerLanguage('matlab', require('./languages/matlab'));96hljs.registerLanguage('maxima', require('./languages/maxima'));97hljs.registerLanguage('mel', require('./languages/mel'));98hljs.registerLanguage('mercury', require('./languages/mercury'));99hljs.registerLanguage('mipsasm', require('./languages/mipsasm'));100hljs.registerLanguage('mizar', require('./languages/mizar'));101hljs.registerLanguage('perl', require('./languages/perl'));102hljs.registerLanguage('mojolicious', require('./languages/mojolicious'));103hljs.registerLanguage('monkey', require('./languages/monkey'));104hljs.registerLanguage('moonscript', require('./languages/moonscript'));105hljs.registerLanguage('nginx', require('./languages/nginx'));106hljs.registerLanguage('nimrod', require('./languages/nimrod'));107hljs.registerLanguage('nix', require('./languages/nix'));108hljs.registerLanguage('nsis', require('./languages/nsis'));109hljs.registerLanguage('objectivec', require('./languages/objectivec'));110hljs.registerLanguage('ocaml', require('./languages/ocaml'));111hljs.registerLanguage('openscad', require('./languages/openscad'));112hljs.registerLanguage('oxygene', require('./languages/oxygene'));113hljs.registerLanguage('parser3', require('./languages/parser3'));114hljs.registerLanguage('pf', require('./languages/pf'));115hljs.registerLanguage('php', require('./languages/php'));116hljs.registerLanguage('pony', require('./languages/pony'));117hljs.registerLanguage('powershell', require('./languages/powershell'));118hljs.registerLanguage('processing', require('./languages/processing'));119hljs.registerLanguage('profile', require('./languages/profile'));120hljs.registerLanguage('prolog', require('./languages/prolog'));121hljs.registerLanguage('protobuf', require('./languages/protobuf'));122hljs.registerLanguage('puppet', require('./languages/puppet'));123hljs.registerLanguage('purebasic', require('./languages/purebasic'));124hljs.registerLanguage('python', require('./languages/python'));125hljs.registerLanguage('q', require('./languages/q'));126hljs.registerLanguage('qml', require('./languages/qml'));127hljs.registerLanguage('r', require('./languages/r'));128hljs.registerLanguage('rib', require('./languages/rib'));129hljs.registerLanguage('roboconf', require('./languages/roboconf'));130hljs.registerLanguage('rsl', require('./languages/rsl'));131hljs.registerLanguage('ruleslanguage', require('./languages/ruleslanguage'));132hljs.registerLanguage('rust', require('./languages/rust'));133hljs.registerLanguage('scala', require('./languages/scala'));134hljs.registerLanguage('scheme', require('./languages/scheme'));135hljs.registerLanguage('scilab', require('./languages/scilab'));136hljs.registerLanguage('scss', require('./languages/scss'));137hljs.registerLanguage('smali', require('./languages/smali'));138hljs.registerLanguage('smalltalk', require('./languages/smalltalk'));139hljs.registerLanguage('sml', require('./languages/sml'));140hljs.registerLanguage('sqf', require('./languages/sqf'));141hljs.registerLanguage('sql', require('./languages/sql'));142hljs.registerLanguage('stan', require('./languages/stan'));143hljs.registerLanguage('stata', require('./languages/stata'));144hljs.registerLanguage('step21', require('./languages/step21'));145hljs.registerLanguage('stylus', require('./languages/stylus'));146hljs.registerLanguage('subunit', require('./languages/subunit'));147hljs.registerLanguage('swift', require('./languages/swift'));148hljs.registerLanguage('taggerscript', require('./languages/taggerscript'));149hljs.registerLanguage('yaml', require('./languages/yaml'));150hljs.registerLanguage('tap', require('./languages/tap'));151hljs.registerLanguage('tcl', require('./languages/tcl'));152hljs.registerLanguage('tex', require('./languages/tex'));153hljs.registerLanguage('thrift', require('./languages/thrift'));154hljs.registerLanguage('tp', require('./languages/tp'));155hljs.registerLanguage('twig', require('./languages/twig'));156hljs.registerLanguage('typescript', require('./languages/typescript'));157hljs.registerLanguage('vala', require('./languages/vala'));158hljs.registerLanguage('vbnet', require('./languages/vbnet'));159hljs.registerLanguage('vbscript', require('./languages/vbscript'));160hljs.registerLanguage('vbscript-html', require('./languages/vbscript-html'));161hljs.registerLanguage('verilog', require('./languages/verilog'));162hljs.registerLanguage('vhdl', require('./languages/vhdl'));163hljs.registerLanguage('vim', require('./languages/vim'));164hljs.registerLanguage('x86asm', require('./languages/x86asm'));165hljs.registerLanguage('xl', require('./languages/xl'));166hljs.registerLanguage('xquery', require('./languages/xquery'));167hljs.registerLanguage('zephir', require('./languages/zephir'));...

Full Screen

Full Screen

language.js

Source:language.js Github

copy

Full Screen

1var BLanguage = BLanguage || {};2BLanguage.formatState = function (state) {3 if (!state.id) {4 return state.text;5 }6 return $('<span><img src="' + $('#language_flag_path').val() + state.element.value.toLowerCase() + '.png" class="img-flag" /> ' + state.text + '</span>');7};8BLanguage.bindEventToElement = function () {9 if (jQuery().select2) {10 $('.select-search-language').select2({11 width: '100%',12 templateResult: BLanguage.formatState,13 templateSelection: BLanguage.formatState14 });15 }16 var table_language = $('.table-language');17 $(document).on('change', '#language_id', function () {18 var language = $(this).find('option:selected').data('language');19 if (typeof language != 'undefined' && language.length > 0) {20 $('#lang_name').val(language[2]);21 $('#lang_locale').val(language[0]);22 $('#lang_code').val(language[1]);23 $('#flag_list').val(language[4]).trigger('change');24 $('.lang_is_' + language[3]).prop('checked', true);25 $('#btn-language-submit-edit').prop('id', 'btn-language-submit').text('Add new language');26 }27 });28 //Botble.callScroll($('.table-language'));29 $(document).on('click', '#btn-language-submit', function (event) {30 event.preventDefault();31 var name = $('#lang_name').val();32 var locale = $('#lang_locale').val();33 var code = $('#lang_code').val();34 var flag = $('#flag_list').val();35 var order = $('#lang_order').val();36 var is_rtl = $('.lang_is_rtl').prop('checked') ? 1 : 0;37 BLanguage.createOrUpdateLanguage(0, name, locale, code, flag, order, is_rtl, 0);38 });39 $(document).on('click', '#btn-language-submit-edit', function (event) {40 event.preventDefault();41 var id = $('#lang_id').val();42 var name = $('#lang_name').val();43 var locale = $('#lang_locale').val();44 var code = $('#lang_code').val();45 var flag = $('#flag_list').val();46 var order = $('#lang_order').val();47 var is_rtl = $('.lang_is_rtl').prop('checked') ? 1 : 0;48 BLanguage.createOrUpdateLanguage(id, name, locale, code, flag, order, is_rtl, 1);49 });50 table_language.on('click', '.deleteDialog', function (event) {51 event.preventDefault();52 $('#delete-crud-entry').data('section', $(this).data('section'));53 $('#delete-crud-modal').modal('show');54 });55 $('#delete-crud-entry').on('click', function (event) {56 event.preventDefault();57 $('#delete-crud-modal').modal('hide');58 var deleteURL = $(this).data('section');59 $.ajax({60 url: deleteURL,61 type: 'GET',62 success: function (data) {63 if (data.error) {64 Botble.showNotice('error', data.message, Botble.languages.notices_msg.error);65 } else {66 if (data.data) {67 table_language.find('i[data-id=' + data.data + ']').unwrap();68 $('.tooltip').remove();69 }70 table_language.find('a[data-section="' + deleteURL + '"]').closest('tr').remove();71 Botble.showNotice('success', data.message, Botble.languages.notices_msg.success);72 }73 },74 error: function (data) {75 Botble.handleError(data);76 }77 });78 });79 table_language.on('click', '.set-language-default', function (event) {80 event.preventDefault();81 var _self = $(this);82 $.ajax({83 url: _self.data('section'),84 type: 'GET',85 success: function (data) {86 if (data.error) {87 Botble.showNotice('error', data.message, Botble.languages.notices_msg.error);88 } else {89 var star = table_language.find('td > i');90 star.replaceWith('<a data-section="' + BLanguage.routes.set_default + '?lang_id=' + star.data('id') + '" class="set-language-default tip" data-original-title="Choose ' + star.data('name') + ' as default language">' + star.closest('td').html() + '</a>');91 _self.find('i').unwrap();92 $('.tooltip').remove();93 Botble.showNotice('success', data.message, Botble.languages.notices_msg.success);94 }95 },96 error: function (data) {97 Botble.handleError(data);98 }99 });100 });101 table_language.on('click', '.edit-language-button', function (event) {102 event.preventDefault();103 var _self = $(this);104 $.ajax({105 url: BLanguage.routes.get_language + '?lang_id=' + _self.data('id'),106 type: 'GET',107 success: function (data) {108 if (data.error) {109 Botble.showNotice('error', data.message, Botble.languages.notices_msg.error);110 } else {111 var language = data.data;112 $('#lang_id').val(language.lang_id);113 $('#lang_name').val(language.lang_name);114 $('#lang_locale').val(language.lang_locale);115 $('#lang_code').val(language.lang_code);116 $('#flag_list').val(language.lang_flag).trigger('change');117 if (language.lang_rtl) {118 $('.lang_is_rtl').prop('checked', true);119 }120 $('#lang_order').val(language.lang_order);121 $('#btn-language-submit').prop('id', 'btn-language-submit-edit').text('Update');122 }123 },124 error: function (data) {125 Botble.handleError(data);126 }127 });128 });129};130BLanguage.createOrUpdateLanguage = function (id, name, locale, code, flag, order, is_rtl, edit) {131 var url = BLanguage.routes.store;132 if (edit) {133 url = BLanguage.routes.edit + '?lang_code=' + code;134 }135 $.ajax({136 url: url,137 type: 'POST',138 data: {139 lang_id: id,140 lang_name: name,141 lang_locale: locale,142 lang_code: code,143 lang_flag: flag,144 lang_order: order,145 lang_is_rtl: is_rtl146 },147 success: function (data) {148 if (data.error) {149 Botble.showNotice('error', data.message, Botble.languages.notices_msg.error);150 } else {151 if (edit) {152 $('.table-language').find('tr[data-id=' + id + ']').replaceWith(data.data);153 } else {154 $('.table-language').append(data.data);155 }156 Botble.showNotice('success', data.message, Botble.languages.notices_msg.success);157 }158 $('#language_id').val('').trigger('change');159 $('#lang_name').val('');160 $('#lang_locale').val('');161 $('#lang_code').val('');162 $('#flag_list').val('').trigger('change');163 $('.lang_is_ltr').prop('checked', true);164 $('#btn-language-submit-edit').prop('id', 'btn-language-submit').text('Add new language');165 },166 error: function (data) {167 Botble.handleError(data);168 }169 });170};171$(document).ready(function () {172 BLanguage.bindEventToElement();...

Full Screen

Full Screen

i18n.js

Source:i18n.js Github

copy

Full Screen

1// ==========================================================================2// Project: The M-Project - Mobile HTML5 Application Framework3// Copyright: (c) 2010 M-Way Solutions GmbH. All rights reserved.4// (c) 2011 panacoda GmbH. All rights reserved.5// Creator: Dominik6// Date: 29.11.20107// License: Dual licensed under the MIT or GPL Version 2 licenses.8// http://github.com/mwaylabs/The-M-Project/blob/master/MIT-LICENSE9// http://github.com/mwaylabs/The-M-Project/blob/master/GPL-LICENSE10// ==========================================================================1112m_require('core/foundation/object.js');1314/**15 * @class16 *17 * M.I18N defines a prototype for internationalisation and localisation within18 * The M-Project. It is used to set and get the application's language and to19 * localize any string within an application.20 *21 * @extends M.Object22 */23M.I18N = M.Object.extend(24/** @scope M.I18N.prototype */ {2526 /**27 * The type of this object.28 *29 * @type String30 */31 type: 'M.I18N',3233 /**34 * The system's default language.35 *36 * @type String37 */38 defaultLanguage: 'en_us',3940 /**41 * This property is used to map the navigator's language to an ISO standard42 * if necessary. E.g. 'de' will be mapped to 'de_de'. Currently we only provide43 * support for english and german. More languages are about to come or can be44 * added by overwriting this property.45 *46 * @type Object47 */48 languageMapper: {49 de: 'de_de',50 en: 'en_us'51 },52 53 /**54 * This method returns the localized string for the given key based on55 * the current language.56 *57 * @param {String} key The key to the localized string.58 * @param {Object} context An object containing value parts for the translated string59 * @returns {String} The localized string based on the current application language.60 */61 l: function(key, context) {62 return this.localize(key, context);63 },6465 /**66 * This method returns the localized string for the given key based on67 * the current language. It is internally used as a wrapper for l() for68 * a better readability.69 *70 * @private71 * @param {String} key The key to the localized string.72 * @param {Object} context An object containing value parts for the translated string73 * @returns {String} The localized string based on the current application language.74 */75 localize: function(key, context) {76 var translation;77 if(!M.Application.currentLanguage) {78 M.Application.currentLanguage = this.getLanguage();79 }80 if(this[M.Application.currentLanguage] && this[M.Application.currentLanguage][key]) {81 translation = this[M.Application.currentLanguage][key];82 } else if(this[M.Application.defaultLanguage] && this[M.Application.defaultLanguage][key]) {83 M.Logger.log('Key \'' + key + '\' not defined for language \'' + M.Application.currentLanguage + '\', switched to default language \'' + M.Application.defaultLanguage + '\'', M.WARN);84 translation = this[M.Application.defaultLanguage][key];85 } else if(this[this.defaultLanguage] && this[this.defaultLanguage][key]) {86 M.Logger.log('Key \'' + key + '\' not defined for language \'' + M.Application.currentLanguage + '\', switched to system\'s default language \'' + this.defaultLanguage + '\'', M.WARN);87 translation = this[this.defaultLanguage][key];88 } else {89 M.Logger.log('Key \'' + key + '\' not defined for both language \'' + M.Application.currentLanguage + '\' and the system\'s default language \'' + this.defaultLanguage + '\'', M.WARN);90 return null;91 }92 if(context) {93 try {94 translation = _.template(translation, context);95 } catch(e) {96 M.Logger.log('Error in I18N: Check your context object and the translation string with key "'+ key + '". Error Message: ' + e, M.ERR);97 }98 }99 return translation;100 },101102 /**103 * This method sets the applications current language and forces it to reload.104 *105 * @param {String} language The language to be set.106 */107 setLanguage: function(language) {108 if(!this.isLanguageAvailable(language)) {109 M.Logger.log('There is no language \'' + language + '\' specified (using default language \'' + this.defaultLanguage + '\' instead!', M.WARN);110 this.setLanguage(this.defaultLanguage);111 return;112 } else if(language && language === M.Application.currentLanguage) {113 M.Logger.log('Language \'' + language + '\' already selected', M.INFO);114 return;115 }116117 if(localStorage) {118 localStorage.setItem(M.LOCAL_STORAGE_PREFIX + M.Application.name + M.LOCAL_STORAGE_SUFFIX + 'lang', language);119 location.href = location.protocol + '//' + location.host + location.pathname;120 }121 },122123 /**124 * This method is used to get a language for the current user. This process is divided125 * into three steps. If one step leads to a language, this on is returned. The steps are126 * prioritized as follows:127 *128 * - get the user's language by checking his navigator129 * - use the application's default language130 * - use the systems's default language131 *132 * @param {Boolean} returnNavigatorLanguage Specify whether to return the navigator's language even if this language is not supported by this app.133 * @returns {String} The user's language.134 */135 getLanguage: function(returnNavigatorLanguage) {136 var language = null;137138 if(localStorage) {139 language = localStorage.getItem(M.LOCAL_STORAGE_PREFIX + M.Application.name + M.LOCAL_STORAGE_SUFFIX + 'lang');140 }141142 if(language) {143 return language;144 } else if(navigator) {145 var regexResult = /([a-zA-Z]{2,3})[\s_.-]?([a-zA-Z]{2,3})?/.exec(navigator.language);146 if(regexResult && this[regexResult[0]]) {147 return regexResult[0].toLowerCase();148 } else if(regexResult && regexResult[1] && this.languageMapper[regexResult[1]]) {149 var language = this.languageMapper[regexResult[1]];150 return language.toLowerCase();151 } else if(M.Application.defaultLanguage) {152 return M.Application.defaultLanguage.toLowerCase();153 } else {154 return this.defaultLanguage;155 }156 } else {157 return this.defaultLanguage;158 }159 },160161 /**162 * This method checks if the passed language is available within the app or not. 163 *164 * @param {String} language The language to be checked.165 * @returns {Boolean} Indicates whether the requested language is available or not.166 */167 isLanguageAvailable: function(language) {168 if(this[language] && typeof(this[language]) === 'object') {169 return true;170 } else {171 M.Logger.log('no language \'' + language + '\' specified.', M.WARN);172 return false;173 }174 }175 ...

Full Screen

Full Screen

tmlanguage.js

Source:tmlanguage.js Github

copy

Full Screen

1var fs = require("fs");2var util = require("util");3var lib = require("./lib");4var parseLanguage = lib.parsePlist;5function logDebug(string, obj) {6 console.log(string, obj);7}8// tmLanguage processor9// for tracking token states10var states = {start: []};11var stateName = "start";12function processRules(rules){13 if (rules.patterns)14 states.start = processPatterns(rules.patterns);15 if (rules.repository)16 processRepository(rules.repository);17 return states;18}19function processRepository(r) {20 for (var key in r) {21 var p = r[key];22 if (p.begin)23 var stateObj = [processPattern(r[key])];24 else if (p.patterns && !p.repository)25 var stateObj = processPatterns(p.patterns);26 else27 var stateObj = [processPattern(r[key])];28 if (stateObj)29 states["#" + key] = stateObj;30 }31}32function processPatterns(pl) {33 return pl.map(processPattern);34}35function processPattern(p) {36 if (p.end == "(?!\\G)" && p.patterns && p.patterns.length == 1) {37 var rule = processPattern(p.patterns[0]);38 }39 else if (p.begin && p.end) {40 var rule = simpleRule(p.begin, p.name, p.beginCaptures || p.captures)41 var next = processPatterns(p.patterns || []);42 var endRule = simpleRule(p.end, p.name, p.endCaptures || p.captures);43 endRule.next = "pop";44 next.push(endRule);45 if (p.name || p.contentName)46 next.push({defaultToken: p.name || p.contentName});47 rule.push = next;48 }49 else if (p.match) {50 var rule = simpleRule(p.match, p.name, p.captures)51 }52 else if (p.include) {53 var rule = {include: p.include};54 }55 if (p.comment)56 rule.comment = (rule.comment || "") + p.comment;57 if (p.repository)58 processRepository(p.repository);59 return rule;60}61function simpleRule(regex, name, captures) {62 name = name || "text";63 var rule = {};64 var origRegex = regex65 regex = transformRegExp(regex, rule);66 if (captures) {67 var tokenArray = [];68 Object.keys(captures).forEach(function(x){69 tokenArray[x] = captures[x] && captures[x].name;70 });71 if (tokenArray.length == 1) {72 name = tokenArray[0];73 } else {74 for (var i = 0; i < tokenArray.length; i++)75 if (!tokenArray[i])76 tokenArray[i] = name;77 name = tokenArray;78 rule.todo = "fix grouping";79 }80 }81 try {new RegExp(regex);} catch(e) {82 rule.TODO = "FIXME: regexp doesn't have js equivalent";83 rule.originalRegex = origRegex84 }85 rule.token = name;86 rule.regex = regex;87 return rule;88}89// regex transformation90function removeXFlag(str) {91 if (str && str.slice(0,4) == "(?x)") {92 str = str.replace(/\\.|\[([^\]\\]|\\.)*?\]|\s+|(?:#[^\n]*)/g, function(s) {93 if (s[0] == "[")94 return s;95 if (s[0] == "\\")96 return /[#\s]/.test(s[1]) ? s[1] : s;97 return "";98 }).substr(4);99 }100 return str;101}102function transformRegExp(str, rule) {103 str = removeXFlag(str);104 //str = str.replace(/\\n\$|\$\\n/g, '$');105 str = str.replace(/\\n(?!\?).?/g, '$'); // replace newlines by $ except if its postfixed by ?106 if (/\(\?[i]\:|\(?\w*i\w*\)/g.test(str)) {107 str = str.replace(/\(\?[ims\-]\:/g, "(?:"); // checkForInvariantRegex108 str = str.replace(/\(\?[imsx\-]\)/g, "");109 rule && (rule.caseInsensitive = true);110 }111 str = str.replace(/(\\[xu]){([a-fA-F\d]+)}/g, '$1$2');112 return str;113}114//115function extractPatterns(tmRules) {116 var patterns = processRules(tmRules);117 return lib.restoreJSONComments(lib.formatJSON(patterns, " "));118}119// cli stuff120var modeTemplate = fs.readFileSync(__dirname + "/mode.tmpl.js", "utf8");121var modeHighlightTemplate = fs.readFileSync(__dirname + "/mode_highlight_rules.tmpl.js", "utf8");122function convertLanguageFile(name) {123 var path = /^(\/|\w:)/.test(name) ? name : process.cwd() + "/" + name124 var tmLanguage = fs.readFileSync(path, "utf8");125 parseLanguage(tmLanguage, function(language) {126 var languageHighlightFilename = language.name.replace(/[-_]/g, "").toLowerCase();127 var languageNameSanitized = language.name.replace(/-/g, "");128 var languageHighlightFile = __dirname + "/../lib/ace/mode/" + languageHighlightFilename + "_highlight_rules.js";129 var languageModeFile = __dirname + "/../lib/ace/mode/" + languageHighlightFilename + ".js";130 console.log("Converting " + name + " to " + languageHighlightFile);131 if (devMode) {132 console.log(util.inspect(language.patterns, false, 4));133 console.log(util.inspect(language.repository, false, 4));134 }135 var languageMode = lib.fillTemplate(modeTemplate, {136 language: languageNameSanitized,137 languageHighlightFilename: languageHighlightFilename138 });139 var patterns = extractPatterns(language);140 var languageHighlightRules = lib.fillTemplate(modeHighlightTemplate, {141 language: languageNameSanitized,142 languageTokens: patterns.trim(),143 uuid: language.uuid,144 name: name145 });146 if (devMode) {147 console.log(languageMode);148 console.log(languageHighlightRules);149 console.log("Not writing, 'cause we're in dev mode, baby.");150 }151 else {152 fs.writeFileSync(languageHighlightFile, languageHighlightRules);153 fs.writeFileSync(languageModeFile, languageMode);154 }155 });156}157var args = process.argv.splice(2);158var tmLanguageFile = args[0];159var devMode = args[1];160if (tmLanguageFile === undefined) {161 console.error("Please pass in a language file via the command line.");162 process.exit(1);163}...

Full Screen

Full Screen

_lang.js

Source:_lang.js Github

copy

Full Screen

1//= require ../lib/_jquery2/*3Copyright 2008-2013 Concur Technologies, Inc.4Licensed under the Apache License, Version 2.0 (the "License"); you may5not use this file except in compliance with the License. You may obtain6a copy of the License at7 http://www.apache.org/licenses/LICENSE-2.08Unless required by applicable law or agreed to in writing, software9distributed under the License is distributed on an "AS IS" BASIS, WITHOUT10WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the11License for the specific language governing permissions and limitations12under the License.13*/14;(function () {15 'use strict';16 var languages = [];17 window.setupLanguages = setupLanguages;18 window.activateLanguage = activateLanguage;19 window.getLanguageFromQueryString = getLanguageFromQueryString;20 function activateLanguage(language) {21 if (!language) return;22 if (language === "") return;23 $(".lang-selector a").removeClass('active');24 $(".lang-selector a[data-language-name='" + language + "']").addClass('active');25 for (var i=0; i < languages.length; i++) {26 $(".highlight.tab-" + languages[i]).hide();27 $(".lang-specific." + languages[i]).hide();28 }29 $(".highlight.tab-" + language).show();30 $(".lang-specific." + language).show();31 window.recacheHeights();32 // scroll to the new location of the position33 if ($(window.location.hash).get(0)) {34 $(window.location.hash).get(0).scrollIntoView(true);35 }36 }37 // parseURL and stringifyURL are from https://github.com/sindresorhus/query-string38 // MIT licensed39 // https://github.com/sindresorhus/query-string/blob/7bee64c16f2da1a326579e96977b9227bf6da9e6/license40 function parseURL(str) {41 if (typeof str !== 'string') {42 return {};43 }44 str = str.trim().replace(/^(\?|#|&)/, '');45 if (!str) {46 return {};47 }48 return str.split('&').reduce(function (ret, param) {49 var parts = param.replace(/\+/g, ' ').split('=');50 var key = parts[0];51 var val = parts[1];52 key = decodeURIComponent(key);53 // missing `=` should be `null`:54 // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters55 val = val === undefined ? null : decodeURIComponent(val);56 if (!ret.hasOwnProperty(key)) {57 ret[key] = val;58 } else if (Array.isArray(ret[key])) {59 ret[key].push(val);60 } else {61 ret[key] = [ret[key], val];62 }63 return ret;64 }, {});65 };66 function stringifyURL(obj) {67 return obj ? Object.keys(obj).sort().map(function (key) {68 var val = obj[key];69 if (Array.isArray(val)) {70 return val.sort().map(function (val2) {71 return encodeURIComponent(key) + '=' + encodeURIComponent(val2);72 }).join('&');73 }74 return encodeURIComponent(key) + '=' + encodeURIComponent(val);75 }).join('&') : '';76 };77 // gets the language set in the query string78 function getLanguageFromQueryString() {79 if (location.search.length >= 1) {80 var language = parseURL(location.search).language;81 if (language) {82 return language;83 } else if (jQuery.inArray(location.search.substr(1), languages) != -1) {84 return location.search.substr(1);85 }86 }87 return false;88 }89 // returns a new query string with the new language in it90 function generateNewQueryString(language) {91 var url = parseURL(location.search);92 if (url.language) {93 url.language = language;94 return stringifyURL(url);95 }96 return language;97 }98 // if a button is clicked, add the state to the history99 function pushURL(language) {100 if (!history) { return; }101 var hash = window.location.hash;102 if (hash) {103 hash = hash.replace(/^#+/, '');104 }105 history.pushState({}, '', '?' + generateNewQueryString(language) + '#' + hash);106 // save language as next default107 localStorage.setItem("language", language);108 }109 function setupLanguages(l) {110 var defaultLanguage = localStorage.getItem("language");111 languages = l;112 var presetLanguage = getLanguageFromQueryString();113 if (presetLanguage) {114 // the language is in the URL, so use that language!115 activateLanguage(presetLanguage);116 localStorage.setItem("language", presetLanguage);117 } else if ((defaultLanguage !== null) && (jQuery.inArray(defaultLanguage, languages) != -1)) {118 // the language was the last selected one saved in localstorage, so use that language!119 activateLanguage(defaultLanguage);120 } else {121 // no language selected, so use the default122 activateLanguage(languages[0]);123 }124 }125 // if we click on a language tab, activate that language126 $(function() {127 $(".lang-selector a").on("click", function() {128 var language = $(this).data("language-name");129 pushURL(language);130 activateLanguage(language);131 return false;132 });133 });...

Full Screen

Full Screen

lang.js

Source:lang.js Github

copy

Full Screen

1/*2Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.3For licensing, see LICENSE.html or http://ckeditor.com/license4*/5(function()6{7 var loadedLangs = {};8 /**9 * @namespace Holds language related functions.10 */11 CKEDITOR.lang =12 {13 /**14 * The list of languages available in the editor core.15 * @type Object16 * @example17 * alert( CKEDITOR.lang.en ); // "true"18 */19 languages :20 {21 'af' : 1,22 'ar' : 1,23 'bg' : 1,24 'bn' : 1,25 'bs' : 1,26 'ca' : 1,27 'cs' : 1,28 'cy' : 1,29 'da' : 1,30 'de' : 1,31 'el' : 1,32 'en-au' : 1,33 'en-ca' : 1,34 'en-gb' : 1,35 'en' : 1,36 'eo' : 1,37 'es' : 1,38 'et' : 1,39 'eu' : 1,40 'fa' : 1,41 'fi' : 1,42 'fo' : 1,43 'fr-ca' : 1,44 'fr' : 1,45 'gl' : 1,46 'gu' : 1,47 'he' : 1,48 'hi' : 1,49 'hr' : 1,50 'hu' : 1,51 'is' : 1,52 'it' : 1,53 'ja' : 1,54 'ka' : 1,55 'km' : 1,56 'ko' : 1,57 'lt' : 1,58 'lv' : 1,59 'mn' : 1,60 'ms' : 1,61 'nb' : 1,62 'nl' : 1,63 'no' : 1,64 'pl' : 1,65 'pt-br' : 1,66 'pt' : 1,67 'ro' : 1,68 'ru' : 1,69 'sk' : 1,70 'sl' : 1,71 'sr-latn' : 1,72 'sr' : 1,73 'sv' : 1,74 'th' : 1,75 'tr' : 1,76 'uk' : 1,77 'vi' : 1,78 'zh-cn' : 1,79 'zh' : 180 },81 /**82 * Loads a specific language file, or auto detect it. A callback is83 * then called when the file gets loaded.84 * @param {String} languageCode The code of the language file to be85 * loaded. If null or empty, autodetection will be performed. The86 * same happens if the language is not supported.87 * @param {String} defaultLanguage The language to be used if88 * languageCode is not supported or if the autodetection fails.89 * @param {Function} callback A function to be called once the90 * language file is loaded. Two parameters are passed to this91 * function: the language code and the loaded language entries.92 * @example93 */94 load : function( languageCode, defaultLanguage, callback )95 {96 // If no languageCode - fallback to browser or default.97 // If languageCode - fallback to no-localized version or default.98 if ( !languageCode || !CKEDITOR.lang.languages[ languageCode ] )99 languageCode = this.detect( defaultLanguage, languageCode );100 if ( !this[ languageCode ] )101 {102 CKEDITOR.scriptLoader.load( CKEDITOR.getUrl(103 '_source/' + // @Packager.RemoveLine104 'lang/' + languageCode + '.js' ),105 function()106 {107 callback( languageCode, this[ languageCode ] );108 }109 , this );110 }111 else112 callback( languageCode, this[ languageCode ] );113 },114 /**115 * Returns the language that best fit the user language. For example,116 * suppose that the user language is "pt-br". If this language is117 * supported by the editor, it is returned. Otherwise, if only "pt" is118 * supported, it is returned instead. If none of the previous are119 * supported, a default language is then returned.120 * @param {String} defaultLanguage The default language to be returned121 * if the user language is not supported.122 * @param {String} [probeLanguage] A language code to try to use,123 * instead of the browser based autodetection.124 * @returns {String} The detected language code.125 * @example126 * alert( CKEDITOR.lang.detect( 'en' ) ); // e.g., in a German browser: "de"127 */128 detect : function( defaultLanguage, probeLanguage )129 {130 var languages = this.languages;131 probeLanguage = probeLanguage || navigator.userLanguage || navigator.language || defaultLanguage;132 var parts = probeLanguage133 .toLowerCase()134 .match( /([a-z]+)(?:-([a-z]+))?/ ),135 lang = parts[1],136 locale = parts[2];137 if ( languages[ lang + '-' + locale ] )138 lang = lang + '-' + locale;139 else if ( !languages[ lang ] )140 lang = null;141 CKEDITOR.lang.detect = lang ?142 function() { return lang; } :143 function( defaultLanguage ) { return defaultLanguage; };144 return lang || defaultLanguage;145 }146 };...

Full Screen

Full Screen

CurrentLanguageTest.js

Source:CurrentLanguageTest.js Github

copy

Full Screen

1/****************************************************************************2 Copyright (c) 2010-2012 cocos2d-x.org3 Copyright (c) 2008-2010 Ricardo Quesada4 Copyright (c) 2011 Zynga Inc.5 http://www.cocos2d-x.org6 Permission is hereby granted, free of charge, to any person obtaining a copy7 of this software and associated documentation files (the "Software"), to deal8 in the Software without restriction, including without limitation the rights9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell10 copies of the Software, and to permit persons to whom the Software is11 furnished to do so, subject to the following conditions:12 The above copyright notice and this permission notice shall be included in13 all copies or substantial portions of the Software.14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN20 THE SOFTWARE.21 ****************************************************************************/22var CurrentLanguageTest = cc.Layer.extend({23 ctor:function () {24 this._super();25 var s = cc.Director.getInstance().getWinSize();26 var label = cc.LabelTTF.create("Current language Test", "Arial", 28);27 this.addChild(label, 0);28 label.setPosition(cc.p(s.width / 2, s.height - 50));29 var labelLanguage = cc.LabelTTF.create("", "Arial", 20);30 labelLanguage.setPosition(cc.p(s.width / 2, s.height / 2));31 var currentLanguageType = cc.Application.getCurrentLanguage();32 switch (currentLanguageType) {33 case cc.LANGUAGE_ENGLISH:34 labelLanguage.setString("current language is English");35 break;36 case cc.LANGUAGE_CHINESE:37 labelLanguage.setString("current language is Chinese");38 break;39 case cc.LANGUAGE_FRENCH:40 labelLanguage.setString("current language is French");41 break;42 case cc.LANGUAGE_GERMAN:43 labelLanguage.setString("current language is German");44 break;45 case cc.LANGUAGE_ITALIAN:46 labelLanguage.setString("current language is Italian");47 break;48 case cc.LANGUAGE_RUSSIAN:49 labelLanguage.setString("current language is Russian");50 break;51 case cc.LANGUAGE_SPANISH:52 labelLanguage.setString("current language is Spanish");53 break;54 }55 this.addChild(labelLanguage);56 }57});58var CurrentLanguageTestScene = TestScene.extend({59 runThisTest:function () {60 var layer = new CurrentLanguageTest();61 this.addChild(layer);62 cc.Director.getInstance().replaceScene(this);63 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { storiesOf } from '@storybook/react';2import { withInfo } from '@storybook/addon-info';3import { withKnobs, text, boolean, number } from '@storybook/addon-knobs/react';4import { withOptions } from '@storybook/addon-options';5import { withBackgrounds } from '@storybook/addon-backgrounds';6import { withReadme } from 'storybook-readme';7import { withIntl } from 'storybook-addon-intl';8import { IntlProvider } from 'react-intl';9import { messages } from '../src/locales';10import Readme from '../README.md';11storiesOf('Button', module)12 .addDecorator(withKnobs)13 .addDecorator(withInfo)14 .addDecorator(withOptions({

Full Screen

Using AI Code Generation

copy

Full Screen

1import { useLanguage } from 'storybook-root'2const App = () => {3 const language = useLanguage()4 return <div>{language}</div>5}6import React from 'react'7import App from './test'8import { Meta } from '@storybook/react'9export default {10} as Meta11export const Default = () => <App />12import React from 'react'13import App from './test'14import { Meta } from '@storybook/react'15export default {16} as Meta17export const Default = () => <App />18import React from 'react'19import App from './test'20import { Meta } from '@storybook/react'21export default {22} as Meta23export const Default = () => <App />24import { Meta } from '@storybook/addon-docs/blocks'25export default {26} as Meta27export const Default = () => <App />28import React from 'react'29import App from './test'30import { Meta } from '@storybook/react'31export default {32} as Meta33export const Default = () => <App />34import React from 'react'35import App from './test'36import { Meta } from '@storybook/react'37export default {38} as Meta39export const Default = () => <App />40import React from 'react'41import App from './test'42import { Meta } from '@storybook/react'43export default {44} as Meta45export const Default = () => <App />46import { Meta } from '@storybook/addon-docs/blocks'47export default {48} as Meta49export const Default = () => <App />50import React from 'react'51import App from './test'52import { Meta }

Full Screen

Using AI Code Generation

copy

Full Screen

1import { useLanguage } from 'storybook-root';2const { t } = useLanguage();3const { t } = useLanguage();4import { useLanguage } from 'storybook-root';5const { t } = useLanguage();6const { t } = useLanguage();7import { useLanguage } from 'storybook-root';8const { t } = useLanguage();9const { t } = useLanguage();10import { useLanguage } from 'storybook-root';11const { t } = useLanguage();12const { t } = useLanguage();13import { useLanguage } from 'storybook-root';14const { t } = useLanguage();15const { t } = useLanguage();16import { useLanguage } from 'storybook-root';17const { t } = useLanguage();18const { t } = useLanguage();19import { useLanguage } from 'storybook-root';20const { t } = useLanguage();21const { t } = useLanguage();22import { useLanguage } from 'storybook-root';23const { t } = useLanguage();24const { t } = useLanguage();25import { useLanguage } from 'storybook-root';26const { t } = useLanguage();27const { t } = useLanguage();28import { useLanguage } from 'storybook-root';29const { t

Full Screen

Using AI Code Generation

copy

Full Screen

1import { useLanguage } from 'storybook-root';2const { language } = useLanguage();3import { useLanguage } from 'storybook-root';4const { language } = useLanguage();5import { useLanguage } from 'storybook-root';6const { language } = useLanguage();7import { useLanguage } from 'storybook-root';8const { language } = useLanguage();9import { useLanguage } from 'storybook-root';10const { language } = useLanguage();11import { useLanguage } from 'storybook-root';12const { language } = useLanguage();13import { useLanguage } from 'storybook-root';14const { language } = useLanguage();15import { useLanguage } from 'storybook-root';16const { language } = useLanguage();17import { useLanguage } from 'storybook-root';18const { language } = useLanguage();19import { useLanguage } from 'storybook-root';20const { language } = useLanguage();21import { useLanguage } from 'storybook-root';22const { language } = useLanguage();23import { useLanguage } from 'storybook-root';24const { language } = useLanguage();25import { useLanguage } from 'storybook-root';26const { language } = useLanguage();27import { useLanguage } from 'storybook-root';28const { language } = useLanguage();29import { useLanguage } from 'storybook-root';30const { language } = useLanguage();31import { useLanguage } from 'storybook-root';32const { language } = useLanguage();

Full Screen

Using AI Code Generation

copy

Full Screen

1import { getLanguage } from 'storybook-root';2console.log(getLanguage());3export const getLanguage = () => {4 return 'English';5};6import { getLanguage } from 'storybook-root/src/index.js';7import { getLanguage } from 'storybook-root/src';8import { getLanguage } from 'storybook-root/src/index';9import { getLanguage } from 'storybook-root/dist/src/index';10import { getLanguage } from 'storybook-root/dist/src';

Full Screen

Using AI Code Generation

copy

Full Screen

1import { language } from 'storybook-root'2const lang = language();3console.log(lang)4const path = require('path')5const root = path.resolve(__dirname, '../')6const path = require('path')7const root = path.resolve(__dirname, '../')8const path = require('path')9const root = path.resolve(__dirname, '../')10const path = require('path')11const root = path.resolve(__dirname, '../')12The above code is not working. I am getting error "ReferenceError: language is not defined" at the line "const lang = language();"13I am able to access the environment variable in storybook, but I am unable to use the environment variable in storybook. I am getting the following error "ReferenceError: language is not defined" at the line "const lang = language();"14I am able to access the environment variable in storybook, but I am unable to use the environment variable in storybook. I am getting the following error "ReferenceError: language is not defined" at the line "const lang = language();"15I am able to access the environment variable in storybook, but I am unable to use the environment variable in storybook. I am getting the following error "ReferenceError: language is not defined" at the line "const lang = language();"16I am able to access the environment variable in storybook, but I am unable to use the environment variable in storybook. I am getting the following error "ReferenceError: language is not defined" at the line "const lang = language();"

Full Screen

Using AI Code Generation

copy

Full Screen

1import { useI18n } from 'storybook-root/src/i18n';2const { t } = useI18n();3console.log(t('welcome'));4import { useI18n } from 'storybook-root/src/i18n';5const { t } = useI18n();6console.log(t('welcome'));

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful