├── LICENCE
├── README.md
├── assets
├── css
│ └── styles.css
├── img
│ ├── fr.svg
│ ├── gb.svg
│ └── language.png
├── js
│ └── prism.js
└── scss
│ ├── _language.scss
│ ├── core
│ ├── _base.scss
│ ├── _classes.scss
│ ├── _normalize.5.0.0.scss
│ ├── _prism.scss
│ ├── _variables-colors.scss
│ └── _variables-fonts.scss
│ └── styles.scss
├── favicon.ico
└── index.html
/LICENCE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Russ Weakley, Max Design
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9 | of the Software, and to permit persons to whom the Software is furnished to do
10 | so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # A semantic, accessible language switcher
2 |
3 | Demo version: https://russmaxdesign.github.io/language-switcher/
4 |
5 | This language switcher uses a simple radio button combination to allow users to change language. There is additional hidden information available for screen reader users. The module works with standard keyboard controls, and it also includes hover, focus and checked background colors.
6 |
7 | See [Licence information](LICENCE) for use.
8 |
--------------------------------------------------------------------------------
/assets/css/styles.css:
--------------------------------------------------------------------------------
1 | .font24{font-size:1.5em}.font22{font-size:1.375em}.font20{font-size:1.25em}.font18{font-size:1.125em}.font16{font-size:1em}.font14{font-size:.875em}.font12{font-size:.75em}.font10{font-size:.625em}.c-black{color:#000}.c-red{color:#b00}.c-white{color:#fff}.c-primary-color{color:#166DCC}.c-secondary-color{color:#2E496E}.bg-black{background-color:#000}.bg-red{background-color:#b00}.bg-white{background-color:#fff}.bg-primary-color{background-color:#166DCC}.bg-secondary-color{background-color:#2E496E}.gray5{color:#f2f2f2}.gray10{color:#e5e5e5}.gray15{color:#d9d9d9}.gray20{color:#ccc}.gray25{color:#bfbfbf}.gray30{color:#b2b2b2}.gray35{color:#a6a6a6}.gray40{color:#999}.gray45{color:#8c8c8c}.gray50{color:gray}.gray55{color:#737373}.gray60{color:#666}.gray65{color:#595959}.gray70{color:#4d4d4d}.gray75{color:#404040}.gray80{color:#333}.gray85{color:#262626}.gray90{color:#1a1a1a}.bg-gray5{background-color:#f2f2f2}.bg-gray10{background-color:#e5e5e5}.bg-gray15{background-color:#d9d9d9}.bg-gray20{background-color:#ccc}.bg-gray25{background-color:#bfbfbf}.bg-gray30{background-color:#b2b2b2}.bg-gray35{background-color:#a6a6a6}.bg-gray40{background-color:#999}.bg-gray45{background-color:#8c8c8c}.bg-gray50{background-color:gray}.bg-gray55{background-color:#737373}.bg-gray60{background-color:#666}.bg-gray65{background-color:#595959}.bg-gray70{background-color:#4d4d4d}.bg-gray75{background-color:#404040}.bg-gray80{background-color:#333}.bg-gray85{background-color:#262626}.bg-gray90{background-color:#1a1a1a}/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:0.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace, monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,html [type="button"],[type="reset"],[type="submit"]{-webkit-appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{height:auto}[type="search"]{-webkit-appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-cancel-button,[type="search"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none}code[class*="language-"],pre[class*="language-"]{color:black;background:none;text-shadow:0 1px white;font-family:Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*="language-"]::-moz-selection,pre[class*="language-"] ::-moz-selection,code[class*="language-"]::-moz-selection,code[class*="language-"] ::-moz-selection{text-shadow:none;background:#b3d4fc}pre[class*="language-"]::selection,pre[class*="language-"] ::selection,code[class*="language-"]::selection,code[class*="language-"] ::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*="language-"],pre[class*="language-"]{text-shadow:none}}pre[class*="language-"]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*="language-"],pre[class*="language-"]{background:#f5f2f0}:not(pre)>code[class*="language-"]{padding:.1em;border-radius:.3em;white-space:normal}.token.comment,.token.prolog,.token.doctype,.token.cdata{color:slategray}.token.punctuation{color:#999}.namespace{opacity:.7}.token.property,.token.tag,.token.boolean,.token.number,.token.constant,.token.symbol,.token.deleted{color:#905}.token.selector,.token.attr-name,.token.string,.token.char,.token.builtin,.token.inserted{color:#690}.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string{color:#a67f59;background:rgba(255,255,255,0.5)}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.function{color:#DD4A68}.token.regex,.token.important,.token.variable{color:#e90}.token.important,.token.bold{font-weight:bold}.token.italic{font-style:italic}.token.entity{cursor:help}*{box-sizing:border-box}body{margin:0;padding:20px;color:#4d4d4d;background:#fff;font-family:helvetica,arial,sans-serif;font-size:1em;line-height:1.2}h1{margin:0 0 .5em;font-size:1.8em}h2{margin:1em 0 .5em;font-size:1.4em}h3{margin:1.5em 0 .3em;font-size:1em;font-weight:bold}h4{margin:1.5em 0 .3em;font-size:.88888888em}h1,h2,h3,h4{color:#2E496E}p{margin:1em 0;line-height:1.5}img{max-width:100%;vertical-align:middle}a:link{color:#166DCC}a:visited{color:#1461b5}a:focus,a:hover{color:#11549e}a:active{color:#b00}hr{display:block;height:5px;border:0;margin:2em 0;background:#f2f2f2}figure{margin:1.5em 0;padding:0}figcaption{font-size:.875em;color:#737373;display:block;margin:.4em 0}table{width:100%;margin:1em 0 2em;border-collapse:collapse}caption{padding:0 0 .5em;font-weight:bold;text-align:left}th,td{border-bottom:1px solid #ccc;padding:.5em 1em;text-align:left;vertical-align:top}th{border-top:1px solid #ccc;border-bottom:2px solid #ccc;font-weight:bold}ul,ol{padding-left:1.5em}ul li,ol li{margin-bottom:.2em}dt{font-weight:bold}dd{margin:0 0 .5em;padding-left:1.5em}.container{max-width:38em;margin:0 auto}.hidden{position:absolute;overflow:hidden;clip:rect(0, 0, 0, 0);width:1px;height:1px;border:0;margin:-1px;padding:0}.markup-heading{color:#2E496E;font-size:1em;font-weight:bold}.example{border:1px solid #ccc;margin:1em 0;padding:1em}.input{margin-bottom:1em}.input__content{display:block;margin:0 0 .2em}.input__control{display:block;width:100%;height:2.2em;border:1px solid #ccc;border-radius:.2em;padding:0 .5em;color:gray;background-color:#fff;font-size:1em;line-height:2.2em}.button-primary{height:2.2em;border:1px solid #11549e;border-radius:.2em;padding:0 1em;cursor:pointer;color:#fff;background:#166DCC;font-family:inherit;font-size:1em;line-height:2.2em}.button-primary:focus,.button-primary:hover{border:1px solid #0c3c70;color:#fff;background:#11549e}.button-primary:active{border:1px solid #800;color:#fff;background:#b00}.button-secondary{height:2.2em;border:1px solid #ccc;border-radius:.2em;padding:0 1em;cursor:pointer;color:#166DCC;background:#fff;font-family:inherit;font-size:1em;line-height:2.2em}.button-secondary:focus,.button-secondary:hover{color:#11549e;background:#f2f2f2}.button-secondary:active{color:#b00;background:#e5e5e5}.language{width:110px;height:30px;font-size:14px;line-height:1;margin:1em 0}.language__container--left,.language__container--right{position:relative;float:left;width:55px;height:30px;padding:5px}.language__label{position:absolute;top:0;left:0;width:55px;height:30px;border:1px solid #ccc;padding:7px 8px 5px 0;background-color:#fff;background-repeat:no-repeat;background-position:7px 7px;background-size:14px;text-align:right;text-transform:uppercase}.language__container--left .language__label{border-radius:4px 0 0 4px}.language__container--right .language__label{border-left:0;border-radius:0 4px 4px 0}.language__control:hover+.language__label,.language__control:focus+.language__label{background-color:#eee}.language__control:checked+.language__label{background-color:#ddd}.language__control:focus+.language__label,.language__control:checked:focus+.language__label{z-index:2;outline:2px solid #85bffd;box-shadow:0 0 8px #85bffd}.language__container--fr .language__label{background-image:url("../img/fr.svg")}.language__container--en .language__label{background-image:url("../img/gb.svg")}
2 |
--------------------------------------------------------------------------------
/assets/img/fr.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/assets/img/gb.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/assets/img/language.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/russmaxdesign/language-switcher/6355636f93a6a205d73ea19a3b79b8a4db69455e/assets/img/language.png
--------------------------------------------------------------------------------
/assets/js/prism.js:
--------------------------------------------------------------------------------
1 | /* http://prismjs.com/download.html?themes=prism&languages=markup+css+sass+scss */
2 | var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(v instanceof a)){u.lastIndex=0;var b=u.exec(v),k=1;if(!b&&h&&m!=r.length-1){if(u.lastIndex=y,b=u.exec(e),!b)break;for(var w=b.index+(c?b[1].length:0),_=b.index+b[0].length,A=m,P=y,j=r.length;j>A&&_>P;++A)P+=r[A].length,w>=P&&(++m,y=P);if(r[m]instanceof a||r[A-1].greedy)continue;k=A-m,v=e.slice(y,P),b.index-=y}if(b){c&&(f=b[1].length);var w=b.index+f,b=b[0].slice(f),_=w+b.length,O=v.slice(0,w),x=v.slice(_),S=[m,k];O&&S.push(O);var N=new a(l,g?n.tokenize(b,g):b,d,b,h);S.push(N),x&&S.push(x),Array.prototype.splice.apply(r,S)}}}}}return r},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(t)}}},a=n.Token=function(e,t,n,a,r){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length,this.greedy=!!r};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var i={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}n.hooks.run("wrap",i);var o=Object.keys(i.attributes).map(function(e){return e+'="'+(i.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+(o?" "+o:"")+">"+i.content+""+i.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,i=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),i&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,document.addEventListener&&!r.hasAttribute("data-manual")&&("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(n.highlightAll):window.setTimeout(n.highlightAll,16):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
3 | Prism.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
4 | Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:{pattern:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(