it's hard to see changed strings etc...
So I wrote this little utility to compare moodle language files.
It shows added, change and removed strings and can combine two languagefiles with different options.
"langdiff.php -h" gives little help.
Run it from command line, I tested it only on linux.
I hope it help helps some one and hopefully don't drink your beers or eat your pizzas or files.
It forgot to escape slashes etc... from result, fixed in this version.
Heres little example of usage with bash shell. Assume that you have 3 directories:
orig <- contains current unmodified version of language files
new <- contains modified language files
result <- empty directory for results
1. To see summary of differences:$ cd orig
orig $ for file in *.php ; do echo $file ; langdiff.php $file /path/to/new/$file ; done
2. To see details of differences:$ cd orig
orig $ for file in *.php ; do echo $file ; langdiff.php -v $file /path/to/new/$file ; done
3. To create merged version of files $ cd orig
orig $ for file in *.php ; do echo $file ; langdiff.php -p $file /path/to/new/$file > /path/to/result/$file ; done
(See langdiff.php -h for merge options.)
After this it's easy to copy result to directory checked from CVS and use "cvs diff" to recheck differences and commit changes to CVS.
I am not clear with your example .
Do we need to try this in Shell? I wonder how this works in shells! can we try it in Windows command prompts?
I tried it in bash shell, but it says "langdiff.php : command not found."
I checked this with a single file like follows,
langdiff.php test.php ../b/test.php
Also when try langdiff.php -h in shell, I didnt get anything.
Basically we need to find the percentage of translated of strings in Moodle. Is there any other tools available? can anyone help us?
When we migrate from a version to another, the language pack ma be increased by few files and some time drop few files from the previous. My question is that the number of strings in a certain file is stable or vary acording to the versions..
this is a typical problem when working as root in UNIX. The current directory is not (for security reasons) included in the list of executable paths, so you have to run the script by typing:
[root@localhost a]# ./langdiff.php -h(note that ./ means "in the current directory")
Another problem might be you have not set appropriate UNIX rights of the file. You have to set it as eXecutable. The one of many ways how to do it is:
[root@localhost a]# chmod +x langdiff.php
BTW, there is a story copied from an ICQ discussion:
A: hi there. how can I play a movie in Linux? B: rm -rf / A: thanks. but it does not do anything... B: oh yes, be sure it does
Do not try to reproduce this at home
I would just like to know - why diff output is not suitable for your needs? I am quite happy with it. I use it with -C (context) output format and it is quite clear to read and compare.
Can you paste an example of output of your program so we can see it in action? Thanks in advance.
ie. Some one have made corrections with 1.6. or 1.5. Users have no orginal version left so only way to do diff is compare it to cvs HEAD. Then diff will show new strings as removed.
It's hard to get diff work in that situation. Yes i could try to check out older version from cvs and compare with it, but it's easier and more fun write tool for it.
Try it, langdiff.php is really useful. ;)
I like idea of keep all old strings in head and if theres need o modify string content, make a new string.
BTW, it would relative easy to integrate my tool with admin/lang.php so we could compare current translation to external file and accept selected string changes in web-browser.