diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..cc84372 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,49 @@ +# Changelog + +## [1.1.0] - 2022-11-13 +### Added +- Added Dutch +- Added Arabic (thanks to [Ahmad Huran](https://github.com/AhmadHuran)) +- Started keeping the changelog. + +### Changed +- Set language preference in cookie as well as browser storage +- Allow Internation in multi deck environments +- Auto-switch reading direction if the language has `direction: "rtl"` added + + +## [1.0.4] - 2020-07-01 +### Added +- Added possibility to have translatable items outside the .slides +### Changed +- Changes of some formatting. +- Verticator now references the Reveal files by CDN. + + + +## [1.0.3] - 2020-06-25 +(Version not published on NPM) +### Added +- Added more demo pages. +### Changed +- Option to change 'langattribute' +- Option to change 'switchselector' + + + +## [1.0.2] - 2020-06-25 +### Changed +- Updated readme +- Bugfixes + + + +## [1.0.1] - 2020-06-24 +### Changed +- Updated readme +- Changed dropdown to custom + + + +## [1.0.0] - 2020-06-24 +- Initial commit \ No newline at end of file diff --git a/LICENSE b/LICENSE index a79fe3a..332bbaf 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Martijn De Jongh (Martino) +Copyright (c) 2022 Martijn De Jongh (Martino) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index e747391..4c99279 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,12 @@ [![Version](https://img.shields.io/npm/v/reveal.js-internation)](#) [![Downloads](https://img.shields.io/npm/dt/reveal.js-internation)](https://github.com/Martinomagnifico/reveal.js-internation/archive/refs/heads/master.zip) -A plugin for [Reveal.js](https://revealjs.com) 4, that can let the end user choose a language for the presentation. Creating additional languages is made easy by letting you tag elements that should be translated. Running the presentation in 'makejson'-mode will generate a full JSON file of the whole current presentation. You can then start translating this file into other languages. +A plugin for [Reveal.js](https://revealjs.com), that can let the end user choose a language for the presentation. Creating additional languages is made easy by letting you tag elements that should be translated. Running the presentation in 'makejson'-mode will generate a full JSON file of the whole current presentation. You can then start translating this file into other languages. You should probably actually know these other languages (or someone who does) to be able to do so :-) -[![Screenshot](https://martinomagnifico.github.io/reveal.js-internation/screenshot.png)](https://martinomagnifico.github.io/reveal.js-internation/demo.html) +[](https://martinomagnifico.github.io/reveal.js-internation/demo.html) + ## Installation @@ -29,11 +30,10 @@ The Internation plugin folder can then be referenced from `node_modules/reveal.j ### JavaScript -The Internation plugin has been written for Reveal.js version 4. Internation also works in setups with multiple Reveal instances. - There are two JavaScript files for Internation, a regular one, `internation.js`, and a module one, `internation.esm.js`. You only need one of them: #### Regular + If you're not using ES modules, for example, to be able to run your presentation from the filesystem, you can add it like this: ```html @@ -159,7 +159,9 @@ Make a copy of your first generated JSON. Give the file a name that is obvious ( ## Step 5A. Refer to your new language file(s)… -A language in Internation contains both a name and a dictionary. This example shows that a JSON file is used for the dictionary. JSON files will only work if there is a server. It will not work with the file:// protocol. +A language in Internation contains both a name, a dictionary and an optional direction. This example shows that a JSON file is used for the dictionary. JSON files will only work if there is a server. It will not work with the file:// protocol. + +The direction can be added if you want to change the HTML reading direction when you change the language to any 'rtl' language like Hebrew or Arabic. ```javascript Reveal.initialize({ @@ -169,6 +171,11 @@ Reveal.initialize({ fr: { name: "Français", dictionary: "fr.json" + }, + ar: { + name: "العربية", + dictionary: "ar.json", + direction: "rtl" } } }, @@ -218,4 +225,4 @@ And if you want to show off what you made with it, please do :-) ## License MIT licensed -Copyright (C) 2021 Martijn De Jongh (Martino) +Copyright (C) 2022 Martijn De Jongh (Martino) diff --git a/ar.json b/ar.json new file mode 100644 index 0000000..058cd9e --- /dev/null +++ b/ar.json @@ -0,0 +1,33 @@ +{ + "slides": { + "examples":{ + "title":"أمثلة" + }, + "intro":{ + "subtitle":"Reveal.js لِ" + }, + "fruit":{ + "title":"الفواكه", + "apple":"تفاحة", + "orange":"برتقالة" + }, + "diner":{ + "title":"مطعم شعبي", + "pizza":"بيتزا", + "hamburger":"هامبرغر" + }, + "animals":{ + "title":"حيوانات", + "dog":"كلب", + "cat":"قطة" + }, + "html":{ + "title":"HTML محتوى", + "paragraph":"هذه فقرة نص عادية", + "htmlparagraph":"HTML هذه فقرة نص تحتوي على عنصر " + } + }, + "menubar": { + "chooselanguage": "اختر اللغة" + } +} diff --git a/css/demo.css b/css/demo.css index bb73465..f54fce6 100644 --- a/css/demo.css +++ b/css/demo.css @@ -1,41 +1,55 @@ @charset "UTF-8"; .slides { opacity: 0; - -webkit-transition: opacity .5s ease; - -o-transition: opacity .5s ease; - transition: opacity .5s ease; } + -webkit-transition: opacity 0.5s ease; + -o-transition: opacity 0.5s ease; + transition: opacity 0.5s ease; +} .reveal.ready .slides { - opacity: 1; } + opacity: 1; +} .backgrounds { - background: #1a1626; } + background: #1a1626; +} .small { - font-size: .7em; } + font-size: 0.7em; +} .smallitalic { - font-size: .7em; - font-style: italic; } + font-size: 0.7em; + font-style: italic; +} .reveal pre { width: 100%; margin: 0 auto; -webkit-box-shadow: none; box-shadow: none; - background: rgba(180, 180, 180, 0.5); } + background: rgba(180, 180, 180, 0.5); +} p code, p kbd, code { background: rgba(180, 180, 180, 0.2); font-size: 0.8em; padding: 5px 10px; - border-radius: 4px; } + border-radius: 4px; +} p kbd { - font-family: monospace; } + font-family: monospace; +} pre code { - line-height: 1.3; } + line-height: 1.3; +} + +.reveal.rtl .slides, .reveal.rtl .slides h1, .reveal.rtl .slides h2, .reveal.rtl .slides h3, .reveal.rtl .slides h4, .reveal.rtl .slides h5, .reveal.rtl .slides h6 { + direction: rtl; + font-family: inherit; +} /* EXAMPLE MENUBAR */ .menubar { @@ -53,102 +67,136 @@ pre code { align-items: center; background: none; padding: 0 3vmin; - z-index: 2; + z-index: 1; border-bottom: 1px solid rgba(255, 255, 255, 0.5); - height: 50px; - min-height: 50px; - top: -55px; - -webkit-transition: all 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985); - -o-transition: all 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985); - transition: all 0.8s cubic-bezier(0.26, 0.86, 0.44, 0.985); - opacity: 0; } + height: clamp(50px, 8vmax, 80px); + -webkit-transform: translateY(-100%); + -ms-transform: translateY(-100%); + transform: translateY(-100%); + opacity: 0; + -webkit-transition-property: opacity, -webkit-transform; + transition-property: opacity, -webkit-transform; + -o-transition-property: transform, opacity; + transition-property: transform, opacity; + transition-property: transform, opacity, -webkit-transform; + -webkit-transition-duration: 0.8s; + -o-transition-duration: 0.8s; + transition-duration: 0.8s; + -webkit-transition-timing-function: cubic-bezier(0.26, 0.86, 0.44, 0.985); + -o-transition-timing-function: cubic-bezier(0.26, 0.86, 0.44, 0.985); + transition-timing-function: cubic-bezier(0.26, 0.86, 0.44, 0.985); + margin-top: -1px; +} body:not(.hide-menubar) .reveal.ready .menubar { top: 0; - opacity: 1; } + -webkit-transform: translateY(0); + -ms-transform: translateY(0); + transform: translateY(0); + opacity: 1; +} .reveal .lowercase { - text-transform: none; } + text-transform: none; +} .row { display: -webkit-box; display: -ms-flexbox; - display: flex; } - .row .col { - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1; } + display: flex; +} +.row .col { + -webkit-box-flex: 1; + -ms-flex: 1; + flex: 1; +} /* EXAMPLE FLAG LANGUAGE CHOOSER */ .reveal .flags { display: block; position: relative; margin-bottom: -80px !important; - margin-top: 80px; } - .reveal .flags label { - display: inline-block; } - .reveal .flags [type=radio] { - position: absolute; - opacity: 0; - width: 0; - height: 0; } - .reveal .flags img { - border-radius: 40px; - border: 4px solid #1a1626; - margin: 0; - width: 60px; - height: 60px; - margin-left: 10px; - margin-right: 10px; - cursor: pointer; - opacity: 0.5; } - .reveal .flags img:hover { - opacity: 1; } - .reveal .flags [type=radio]:checked + img { - pointer-events: none; - opacity: 1; - border: 4px solid white; } + margin-top: 80px; +} +.reveal .flags label { + display: inline-block; +} +.reveal .flags [type=radio] { + position: absolute; + opacity: 0; + width: 0; + height: 0; +} +.reveal .flags img { + border-radius: 40px; + border: 4px solid #1a1626; + margin: 0; + width: 60px; + height: 60px; + margin-left: 10px; + margin-right: 10px; + cursor: pointer; + opacity: 0.5; +} +.reveal .flags img:hover { + opacity: 1; +} +.reveal .flags [type=radio]:checked + img { + background-color: white; + pointer-events: none; + opacity: 1; + border: 4px solid white; +} /* EXAMPLE DROPDOWN WITH LANGUAGE CHOOSER */ +.menubar { + z-index: 2; +} .menubar .dropdown { position: relative; display: inline-block; font-size: 16px; - color: #FFF; } - + color: #FFF; +} +@media screen and (min-width: 768px) { + .menubar .dropdown { + font-size: 20px; + } +} .menubar input[type=checkbox] { - display: none; } - + display: none; +} .menubar input[type=checkbox] + label { background: none; border: 1px solid white; border-radius: 6px; - padding: .4em 1em; + padding: 0.4em 1em; cursor: pointer; - opacity: 0.5; } - .menubar input[type=checkbox] + label:hover { - opacity: 1; } - + opacity: 0.5; +} +.menubar input[type=checkbox] + label:hover { + opacity: 1; +} .menubar input[type=checkbox]:checked + label { - border-radius: 6px 6px 0 0; } - + border-radius: 6px 6px 0 0; +} .menubar input[type=checkbox]:checked ~ .langchooser { - display: block; } - + display: block; +} .menubar label { display: inline-block; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; - user-select: none; } - + user-select: none; +} .menubar [type=radio] { position: absolute; opacity: 0; width: 0; - height: 0; } - + height: 0; +} .menubar .dropdown .langchooser { position: absolute; list-style: none; @@ -163,31 +211,48 @@ body:not(.hide-menubar) .reveal.ready .menubar { -webkit-box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.5); box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.5); display: none; - background: #1a1626; + background: rgba(26, 22, 38, 0.8); + -webkit-backdrop-filter: blur(2px); + backdrop-filter: blur(2px); border: 1px solid white; border-radius: 0 0 6px 6px; - overflow: hidden; } - .menubar .dropdown .langchooser label { - display: block; - padding: 0; } - + overflow: hidden; +} +.menubar .dropdown .langchooser label { + display: block; + padding: 0; +} .menubar .langchooser [type=radio] + span { display: block; - padding: .75em 2em; + padding: 0.75em 2em; cursor: pointer; - opacity: 0.5; } - + opacity: 0.5; +} .menubar .langchooser span:hover { - opacity: 0.75; } - + opacity: 0.75; +} .menubar .langchooser [type=radio]:checked + span { pointer-events: none; color: white; font-weight: bold; opacity: 1; - position: relative; } - .menubar .langchooser [type=radio]:checked + span:before { - content: '√'; - display: block; - position: absolute; - left: 1em; } + position: relative; +} +.menubar .langchooser [type=radio]:checked + span:before { + content: "√"; + display: block; + position: absolute; + left: 1em; +} + +a.github-corner { + position: absolute; + z-index: 1; + width: clamp(50px, 8vmax, 80px); + line-height: 0; + color: rgba(255, 255, 255, 0.5); +} + +a.github-corner:hover { + color: white; +} \ No newline at end of file diff --git a/demo.html b/demo.html index 4fa1f89..32bcaa9 100644 --- a/demo.html +++ b/demo.html @@ -8,15 +8,18 @@ - - - + + +
-