Giter Site home page Giter Site logo

internationalization about prosopopee HOT 8 OPEN

psycojoker avatar psycojoker commented on May 27, 2024
internationalization

from prosopopee.

Comments (8)

julienmalik avatar julienmalik commented on May 27, 2024

Also, loading of the proper translated flavor of the site depending on user's settings would be awesome, but this is probably impossible with a static website. is it really ?

from prosopopee.

julienmalik avatar julienmalik commented on May 27, 2024

See https://www.flag-sprites.com/ for free flags with css code ready

from prosopopee.

julienmalik avatar julienmalik commented on May 27, 2024

with a small javascript snippet it should be possible to redirect to the user's language specific version of the page (more or less like simone does for yunohost doc ?)

from prosopopee.

julienmalik avatar julienmalik commented on May 27, 2024

See https://github.com/yunohost/yunohost-admin/blob/unstable/src%2Fjs%2Fyunohost%2Fmain.js#L111-L119

redirect in js with : document.location.href = "https://tonporn.com"

from prosopopee.

julienmalik avatar julienmalik commented on May 27, 2024

Jinja has a gettext extension : http://jinja.pocoo.org/docs/dev/extensions/#i18n-extension
This could probably help a lot, and decouple quite well localization functionnalities from the core of prosopopee.

I made an attempt with stuff like :

title:
  fr: Salut
  es: Ola

but I fear this will become complex to handle all the different text attributes of individual sections which all have a different data model (e.g. full-picture and text).

from prosopopee.

Psycojoker avatar Psycojoker commented on May 27, 2024

Regarding flags: I've been taugh that using flag is apparently bad for i18n and that language name or short name should be used instead.

from prosopopee.

julienmalik avatar julienmalik commented on May 27, 2024

An experiment i'm relatively happy with : https://gist.github.com/julienmalik/e6544ad26e82bae4381c

from prosopopee.

julienmalik avatar julienmalik commented on May 27, 2024

beginning of a solution here : https://github.com/julienmalik/prosopopee/tree/internationalization
it generates index.$lang.html for all langs if you put e.g. :

multilingual: 
  - fr
  - es

in the root settings.yaml

to be multilingual the gallery .yaml then needs to be like :

title:
    fr: Salut
    es: Ola

but the monolingual case is still supported as before.
when generating a multilingual version, if a string is not translated (title: Hello) then it is used for all languages.

multi langages are supported only for title, subtitle and text keys.

from prosopopee.

Related Issues (20)

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.