Git Product home page Git Product logo

jekyll-trans's Introduction

jekyll-trans

Common code for multilingual Jekyll sites

Acknowledgments

Guide that inspired this Thanks goes to @sylvaindurand.

Usage

  1. Add this repo as submodule to _includes;
  2. Make the following: _layouts/redirect.html, _includes/t.html, _includes/langbox.html;
  3. In all of those files put the following: {% include jekyll-trans/<filename>.html %} (replace <filename> ofc). This is to dance around GitHub pages' symlink limitations;
  4. Create folders named after languages you have, put index.html referencing your normal layout. In root index.html reference a redirect layout;
  5. Use as {% include t.html s='translation_string_id' %}
  6. Include lang = {{ page.lang }} in your <html> tag
  7. Put default lang variables over paths, i.e.:
defaults:
  -
    scope:
      path: uk
    values:
      lang: uk
  -
    scope:
      path: en
    values:
      lang: en
  1. Define translation strings as:
t:
  en:
    lang:          'English'
    key:           'value'
    key2:          'value2'
  1. Key lang is assumed to be the language's name in itself, for the purposes of the language selection UI.
  2. For UI JavaScript include langbox_js.html from somewhere relevant, e.g. {% include jekyll-trans/langbox_js.html %} from your scripts.html include.
  3. Provide the EU cookie directive translations at: t.lang.cookie_banner.

TODO:

  • blog setup i.e. links to page's translation
  • make cookie thing optional

jekyll-trans's People

Contributors

landswellsong avatar 0181532686cf4a31163be0bf3e6bb6732bf avatar

Watchers

James Cloos avatar  avatar  avatar Rostyslav Golda avatar Rodriguez Ruslan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.