Comments (29)
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.
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.
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.
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.
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.
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.
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.
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.
@SammysHP And how can the user select the language?
from cgeo.github.io.
That is done automatically depending on the language set in the browser.
from cgeo.github.io.
Somehow that doesn't work for me ...
... although I set the preferred language in Firefox to German.
from cgeo.github.io.
a) There are no translations yet (except for one paragraph), so mostly English is shown.
b) It requires JavaScript.
from cgeo.github.io.
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.
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.
@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.
Nope, that's not possible.
from cgeo.github.io.
@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.
@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.
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.
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.
It's yaml, it could be easily parsed and reformated. I could write a python script for that.
from cgeo.github.io.
@SammysHP Here is a small script for the conversion: https://gist.github.com/kumy/fac092e097a233a308ed115e6361371b
from cgeo.github.io.
Nice, thank you! I'll convert the faq tomorrow and merge the PR.
from cgeo.github.io.
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.
@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.
@SammysHP please see #112
(I wrote the script for python 2)
from cgeo.github.io.
@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.
@SammysHP PR and gist udpated :)
from cgeo.github.io.
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)
- FAQ: Include problem about long startup time
- FAQ: Add explanation about font size change
- FAQ: Add info about missing transparent background
- FAQ: Add info about migration of global hiding and filter into filter framework
- Add Samsung device problem to FAQ HOT 1
- FAQ: Prefix setting for lab2gpx
- Add FAQ entry about Android 12 web intent workarounds/problems
- Use SVG as favicon instead of ICO
- Remove whereyougolanding.html when new repo is in place
- Trackable indication no longer present on search results
- FAQ - ALC not shown when D/T filtering active
- Remove "Special setting for Chrome" on send2cgeo page
- FAQ - Update nearby limit facts
- FAQ: Add info about Xiaomi color problem
- FAQ - Give hint where to find "Go to" in bottom nav version
- FAQ article for setting bat optimization to at least "Normal" HOT 4
- Another item for the FAQ - Hillshading HOT 1
- Add explanation for non-availability of mapy.cz to FAQ
- Downloading nightlys from cgeo.org.development is broken
- FAQ: Describe alternatives for deprecated "Go to" features HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cgeo.github.io.