Giter VIP home page Giter VIP logo

Comments (29)

SammysHP avatar SammysHP commented on September 27, 2024

Language detection only with JavaScript. Then there are two possibilities:

a) /faq_en.html, /faq_de.html
b) faq.html with content generated by JavaScript.

from cgeo.github.io.

Bananeweizen avatar Bananeweizen commented on September 27, 2024

I'm not so sure if a separate file is really a good idea. If you put the different language entries all in the same file then

  • it is easier to compare them (as author/translator), even in the browser editor
  • we can add logic to output the English version if no translated version is available.

However, I would still like to produce multiple HTML files even from this one source file, and I have no clue if that is easily possible with our generator.

from cgeo.github.io.

SammysHP avatar SammysHP commented on September 27, 2024

Creating multiple html files would be possible by creating multiple files in jenkins. But when you link to the FAQ you link also to a specific language.

So my idea: Create the html page as it is now and add a JSON array containing all translation. Then the English entries can be replaced with the detected language via JavaScript.

from cgeo.github.io.

mucek4 avatar mucek4 commented on September 27, 2024

What about adding all content in single HTML file and hiding content with CSS/JavaScript? If JS would be disabled everything would be visible instead of nothing?

from cgeo.github.io.

SammysHP avatar SammysHP commented on September 27, 2024

The English text would be visible like it is now. The JavaScript would replace the English text with the translation (where provided).

from cgeo.github.io.

Lineflyer avatar Lineflyer commented on September 27, 2024

For me it would be important that it is possible to use the same URL and the desired language can then be selected by the user (or automatically selected).
So that we can always give out e.g. http://www.cgeo.org/faq.html#ios and the user is directed to the correct language anyway.

from cgeo.github.io.

Lineflyer avatar Lineflyer commented on September 27, 2024

FYI: There are some volunteers sometimes contacting us via support or FB for translation...however preferably the translation should be hosted on Crowdin.

from cgeo.github.io.

SammysHP avatar SammysHP commented on September 27, 2024

Here it is. Please test it. Should work, but the code (or the way it works) is ugly. It sends all translations to the browser (in hidden containers) and uses JavaScript to show the specific language. Without JS only English is shown.

@Lineflyer There's some work in the FAQ file:

  • Apply the new format to the old FAQ (I already started)
  • Translate everything

from cgeo.github.io.

brainscript avatar brainscript commented on September 27, 2024

@SammysHP And how can the user select the language?

from cgeo.github.io.

SammysHP avatar SammysHP commented on September 27, 2024

That is done automatically depending on the language set in the browser.

from cgeo.github.io.

brainscript avatar brainscript commented on September 27, 2024

Somehow that doesn't work for me ...
... although I set the preferred language in Firefox to German.

from cgeo.github.io.

SammysHP avatar SammysHP commented on September 27, 2024

a) There are no translations yet (except for one paragraph), so mostly English is shown.
b) It requires JavaScript.

from cgeo.github.io.

brainscript avatar brainscript commented on September 27, 2024

I do have JavaScript (and I'm not using NoScript), console.log(navigator.language) returns de and "Temporary issues" is still English although it should be translated to "Vorübergehende Probleme".

from cgeo.github.io.

SammysHP avatar SammysHP commented on September 27, 2024

Any errors in the console? Are you sure that you are on the correct branch? This is not on master yet.

https://github.com/cgeo/cgeo.github.io/tree/translation

from cgeo.github.io.

brainscript avatar brainscript commented on September 27, 2024

@SammysHP Forget about it. 😄 I didn't use branches before, so I didn't recognize that.
Is it possible to preview pages from different branches using GitHub pages?
Because due to the fact that I had to reinstall my OS, I currently haven't got Jekyll installed.

from cgeo.github.io.

SammysHP avatar SammysHP commented on September 27, 2024

Nope, that's not possible.

from cgeo.github.io.

Lineflyer avatar Lineflyer commented on September 27, 2024

@SammysHP
Can you document (e.g. in the Wiki) what exactly needs to be done for the two tasks you mentioned above?

from cgeo.github.io.

SammysHP avatar SammysHP commented on September 27, 2024

@Lineflyer
Just look at the new format of _data/faq.yml in #109. It is:

- id: section-id
  title:
      en: English section title
      de: German section title
  items:
      - id: id-of-entry
        en:
            title: English title
            content: |
                English text body
        de:
            title: German title
            content: |
                German text body

If somebody wants to transform it into the new format, just do it and post it somewhere – I'll update the pull requests with the new content. The translation is optional, so it would be enough to copy the English content at the moment.

from cgeo.github.io.

Lineflyer avatar Lineflyer commented on September 27, 2024

Oh. I did not see #109 yet. Now I understand.
Is there a way a automatically proccess the FAQ on master to get a final hierarchy for en. If this is in master I could sequentially add german translations as time permits.

from cgeo.github.io.

SammysHP avatar SammysHP commented on September 27, 2024

Unless @samueltardieu has some awk/sed trick to convert it, it might be faster to do it by hand. ;)

Old format for comparison:

- title: English section title
  items:
      - title: English title
        id: id-of-entry
        content: |
            English text body

from cgeo.github.io.

kumy avatar kumy commented on September 27, 2024

It's yaml, it could be easily parsed and reformated. I could write a python script for that.

from cgeo.github.io.

kumy avatar kumy commented on September 27, 2024

@SammysHP Here is a small script for the conversion: https://gist.github.com/kumy/fac092e097a233a308ed115e6361371b

from cgeo.github.io.

SammysHP avatar SammysHP commented on September 27, 2024

Nice, thank you! I'll convert the faq tomorrow and merge the PR.

from cgeo.github.io.

Lineflyer avatar Lineflyer commented on September 27, 2024

Thanks for your effort @kumy

As soon as @SammysHP merged the new format and the needed Javascript I will begin adding german translations as time permits.

from cgeo.github.io.

SammysHP avatar SammysHP commented on September 27, 2024

@kumy
Can you please check your script or even send me the faq.yml file?

Traceback (most recent call last):
  File "./cgeo-faq-convert.py", line 52, in <module>
    convert(OldFaq(faq_entry))
  File "./cgeo-faq-convert.py", line 35, in convert
    print(re.sub(r'^', '                ', item['content'].encode('utf-8'), flags=re.MULTILINE))
  File "/usr/lib/python3.5/re.py", line 182, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: cannot use a string pattern on a bytes-like object

from cgeo.github.io.

kumy avatar kumy commented on September 27, 2024

@SammysHP please see #112
(I wrote the script for python 2)

from cgeo.github.io.

SammysHP avatar SammysHP commented on September 27, 2024

@kumy
Sorry, wrong format. items: is missing. Can you update your PR? Otherwise I can run the script tomorrow with python 2.

from cgeo.github.io.

kumy avatar kumy commented on September 27, 2024

@SammysHP PR and gist udpated :)

from cgeo.github.io.

kumy avatar kumy commented on September 27, 2024

And gist also updated for the TypeError: cannot use a string pattern on a bytes-like object error. (I hope)

from cgeo.github.io.

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.