Languages

 
 
Picture of David Mudrák
langdoc.php - a tool for online docs and help files translation
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Translators
Hi!

I've written a small script that can be used for online translation of /docs and /help files. Maybe you can find it useful for your needs wink

langdoc.png

How to install:
  1. download attached langdoc.php
  2. copy it into your /admin Moodle directory
  3. go to http://yourmoodle.url/admin/langdoc.php

 
Average of ratings: -
Martin in black and white
Re: langdoc.php - a tool for online docs and help files translation
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
Yay!  We've needed that for ages - that's going straight into CVS!
 
Average of ratings: -
Picture of János Fehér
Re: langdoc.php - a tool for online docs and help files translation
 
Can we use it on moodle.org? I still waiting for an account to the CVS =)
 
Average of ratings: -
Martin in black and white
Re: langdoc.php - a tool for online docs and help files translation
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
Sorry, I never saw any mail from you ... just found it now though!  blush Will mail you back.
 
Average of ratings: -
Picture of János Fehér
Re: langdoc.php - a tool for online docs and help files translation
 
It's interesting...
2005-02-11 15:10:55 1CzbVT-000HMe-0i <= feher.janos@mindworks.hu H=adsl215151.vnet.hu (golem.devel.mindworks.hu) [62.77.215
.151] P=esmtp S=1618 id=1108131037.2648.30.camel@ganja.devel.mindworks.hu
2005-02-11 15:10:57 1CzbVT-000HMe-0i => martin@moodle.org R=dnslookup T=remote_smtp H=moodle.org [69.93.78.186] X=TLSv1:AES
256-SHA:256
2005-02-11 15:10:57 1CzbVT-000HMe-0i Completed
The letter was:
Hello Martin, Near half year ago I've sent you a letter about Hungarian translation of Moodle but you haven't answered me. I try to actualize and organize the translation, but I should get a CVS account (aries69 at SF) to update the language files. Can you help me? Bests,
 
Average of ratings: -
Martin in black and white
Re: langdoc.php - a tool for online docs and help files translation
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
Just because mail gets into my mailbox doesn't mean I always see it! tongueout You should see the size of that thing! Anyhow, I replied today ... you should contact Karoly who is coordinating Hungarian.
 
Average of ratings: -
Picture of David Mudrák
Re: langdoc.php - how to handle CVS tags?
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Translators
Hi folks

I'd like to ask you - should I care about some CVS tags of langdoc.php or is this Martin's job? I've read developer manual but being still CVS beginner I don't understand very much how langdoc.php will became part of official (pre)release.

Thanks for any explanation.

David
 
Average of ratings: -
Martin in black and white
Re: langdoc.php - how to handle CVS tags?
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
Unless there's a big problem with it it will be in Moodle 1.5. Is it all working correctly now?
 
Average of ratings: -
Picture of koen roggemans
Re: langdoc.php - a tool for online docs and help files translation
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup Translators
Going to test this immediately. Thanks a lot!
 
Average of ratings: -
Picture of koen roggemans
Re: langdoc.php - a tool for online docs and help files translation
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup Translators
Works great. I love the preview button. With firefox tidy installed, you can immediately check the xhtml-compliance as well, without the need having the site on the internet or to click several times and that for  both English and translated file smile

 I just  changed the (!) for untranslated files in *** for visability, but I might as wel need new glasses big grin
 
Average of ratings: -
Picture of Mitsuhiro Yoshida
Re: langdoc.php - a tool for online docs and help files translation
Group DevelopersGroup Documentation writersGroup Translators
Thank you, Great work!
I really love this new cool feature. wink
 
Average of ratings: -
Picture of Ling Li
Re: langdoc.php - a tool for online docs and help files translation
 
I have used it on my 1.4.3 installation and it works fine except one problem.

I found the script create a new empty file when I choose a file not existing from the dropdown list, no matter I press save button or not. If I haven't write anything, I will have to delete the empty file by hand sometime later or it prevent the English one being displayed. Maybe it's better not save the empty file.
 
Average of ratings: -
Picture of David Mudrák
Re: langdoc.php - a lot of empty files
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Translators
I know about this problem. It is caused by touch() function (langdoc.php tries to create non-existing file in order to check permissions). I'll try to change this behaviour ASAP.
 
Average of ratings: -
Picture of Anders Berggren
Svar: langdoc.php - a tool for online docs and help files translation
Group DevelopersGroup Translators
Very cool! Thanks.
Anders, Swedish translator.
 
Average of ratings: -
Picture of David Mudrák
Re: langdoc.php - PATCH #1
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Translators
To fix Ling Li's bugreport I've patched langdoc.php. Empty files doesn't remain in the directory now smile As long as I haven't got CVS write access I attach patched version to this post.

Thanks all for your feedback!

David (http://moodle.cz)
 
Average of ratings: -
Martin in black and white
Re: langdoc.php - PATCH #1
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
Hi, David!  I made quite a few changes to the script when I checked it in, so this is out of date already!  tongueout

I've given you CVS access to it so make fixes there!  Thanks!
 
Average of ratings: -
Picture of Petr Skoda
Re: langdoc.php - PATCH #1
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful Moodlers
...looking at the code array $options is not initialized wink
 
Average of ratings: -
Picture of David Mudrák
Re: langdoc.php - code array $options is not initialized
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Translators
Ahoj

Sorry for this. Being newbie to Moodle coding style I forgot this stuff. Good job, Security Officer wink
 
Average of ratings: -
Picture of David Mudrák
Re: langdoc.php - PATCH #1 committed
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Translators
Done - the patched version is in CVS. I hope it is clean and without bugs now. Thanks for your help!
 
Average of ratings: -
Picture of Nicolas Martignoni
Re: langdoc.php - PATCH #1 committed
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup TestersGroup Translators
Hi,

Many, many thanks for this tool !

May I suggest to the translators that ANY file in the help folder begins with this string on the first line:

<!-- Version: $Id$ -->

and to set the $filetemplate var in langdoc.php accordingly by default. This way we could know rapidly when the last changes were made. It could be very useful big grin

Thanks again !

Nicolas, french translator
 
Average of ratings: -
Picture of Lasha Altunashvili
Re: langdoc.php - a tool for online docs and help files translation
 
Hi,
Thanks a lot for this script. It's great.

I change it a little bit and added editor support. It is much easier for other translators to do the translation in editor rather then in HTML.
Lasha



 
Average of ratings: -
Picture of Lasha Altunashvili
Re: langdoc.php - a tool for online docs and help files translation
 
Sorry, here is the script.

 
Average of ratings: -
Martin in black and white
Re: langdoc.php - a tool for online docs and help files translation
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
Sorry, but this is not a good idea, because the editor will produce a lot of messy HTML code with styles in the help files that will need to be cleaned up.

The help files must remain free of all styles so that they can be used in different contexts.
 
Average of ratings: -
Picture of Lasha Altunashvili
Re: langdoc.php - a tool for online docs and help files translation
 
Thanks for your reply Martin. You are right, WYSIWYG editors have there drawback, however you can always switch to the html source editing and compare original to the translated one. HTML editor may encourage other people to translate entire help. As you know not all the help files are translated to other languages (e.g. Russian). I think completely translated help is more valuable than extra several Kb of HTML code.

Anyway this script helps us to move more quickly and other people may find it useful as well. We will make sure all the doc/help files are clean from any extra code.

Thanks again
Lasha
 
Average of ratings: -
Picture of David Mudrák
Re: langdoc.php - a tool for online docs and help files translation
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Translators
Hi Lasha
I don't think so - IMHO it is not a  good idea to allow wysiwyg in langdoc.php (for the same reasons as Martin noted). And I don't think that HTML editor would encourage other people to translate help - at least not in my country wink But maybe you will find a way how to keep the code clean...
And the last note: my experiences show me it is not necessary to have whole help and doc translated. Users don't read it anyway - they always try to find their own solutions wink

david
 
Average of ratings: -
Picture of Lasha Altunashvili
Re: langdoc.php - a tool for online docs and help files translation
 

Hello David,

I like this one "Users don't read it anyway" smile.

About the way to keep it clean. We are copying the original html to translation box, changing it to HTML and replacing the English text with our translation. it works pretty well.

Our problem is that several translation team members are not familiar with HTML and they prefer to work in editor.

Lasha

 
Average of ratings: -
Martin in black and white
Re: langdoc.php - a tool for online docs and help files translation
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
If they are not familiar with HTML then it seems even more likely that using the editor will cause problems in the code.

It doesn't take long to learn what the HTML codes do, and they don't need to change them anyway, just avoid them.
 
Average of ratings: -
Picture of Jaime Villate
Re: langdoc.php - a tool for online docs and help files translation
 
Very nice. Thanks David!

But I have a problem:

When I translate a page that includes some php script, it is
replaced by the result of the script.

For example, in the Installation FAQ (faq.html) there is a place
where it is suggested that the user writes the script

<?PHP phpinfo() ?>

to find out what PHP version is running. When I save the changes
to my translation, that line is replaced by the whole outpout
from that command (that does not happen if you edit the file
using the file module).
 
Average of ratings: -
Picture of David Mudrák
Re: langdoc.php - should we allow PHP included?
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Translators
Hi Jaime

Thanks for your report! The important question has arised: are <? <php and <PHP tags allowed to be included in help and doc files? Are they needed somewhere? The current version of langdoc assumes the translator to be responsible for the HTML code so it allows put these tags. But we can let some filters to be applied before saving the code.
One has got possibility to include these tags with & lt;php syntax (how is it called - HTML entities?) so I would prefer not to filter anything and trust the translators...

David
 
Average of ratings: -
Picture of Jaime Villate
Re: langdoc.php - should we allow PHP included?
 
Yes, you are right.

I did not explain the problem correctly. The current bug is:
when the user first translates the file, he will use entities
&lt; and &gt; when he wants to refer to some tag.

If he tries to edit the translated file again, the
&lt; and &gt; entities in the original file are shown
as < and > in the translation form.
When the user saves the file, even if no changes were done, the
file will be spoiled (the literal tags that were initially
written correctly using entities will be transformed into real tags, causing trouble).

Also. I have not checked it yet, but a single backslash in the original
file should not become a double backslash when one saves a new
version of the file (that was a bug that we already fixed in
the file module).
 
Average of ratings: -
Picture of Jaime Villate
fix for langdoc.php
 
Translators can see the problem I was referring to if the try
to look at any of the mods.html files, for instance help/hotpot/mods.html, using langdoc.php

You can compare what langdoc.php shows you with the real content
of the file:
http://cvs.sourceforge.net/viewcvs.py/moodle/moodle/lang/en/help/hotpot/mods.html?rev=1.4&view=markup

Due to that bug, there are several translated files,
in several languages, which are wrong. For instance, look at the
Dutch translation of the file above (no need to know Dutch;
just compare the URL in the first line):

http://cvs.sourceforge.net/viewcvs.py/moodle/moodle/lang/nl/help/hotpot/mods.html?rev=1.1&view=markup

The file I send in attachment solves the bug.
 
Average of ratings: -
Picture of koen roggemans
Re: fix for langdoc.php
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup Translators
Yes, I've been fooled by that one today verlegen.
So it's the editor causing trouble. Thanks for pointing that out.

I've found about 18 affected files over all language packs in ja/ja_utf8, lt and sv.

I'll fix them asap
 
Average of ratings: -
Picture of koen roggemans
Re: fix for langdoc.php
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup Translators
done
 
Average of ratings: -
Picture of Mitsuhiro Yoshida
Re: fix for langdoc.php
Group DevelopersGroup Documentation writersGroup Translators
Thanks for ja, ja-utf8 fix! wink
 
Average of ratings: -
Picture of Jaime Villate
Re: fix for langdoc.php
 
> I've found about 18 affected files over all language packs in
> ja/ja_utf8, lt and sv

Good job, Koen. You only missed the Finish language (fi) where
instead of "localhost" you should look for occurrances of
"http://moodlepalvelut.fi" which most be the server where
the Finish team has been running langdoc.php

 
Average of ratings: -
Picture of koen roggemans
Re: fix for langdoc.php
Group DevelopersGroup Documentation writersGroup Particularly helpful MoodlersGroup Translators
They don't make it easy up north. Thanks Searched for http in mods and found 16 more
 
Average of ratings: -
Picture of David Mudrák
Re: langdoc.php - prevent PHP parsing
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Translators
Thanx Jaime for his report again! There has been a bug in langdoc.php: The content of textarea edit fields has been obtained by include() function and thus been parsed by PHP. I've just changed the code to read the files directly by fread() without PHP processing. I'm going to do some tests and will commit patched version to CVS today.

D.
 
Average of ratings: -