Shoutbox

MsgPlus Hotkey Checker - 1.1.3 - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Translation (/forumdisplay.php?fid=24)
+----- Thread: MsgPlus Hotkey Checker - 1.1.3 (/showthread.php?tid=25313)

MsgPlus Hotkey Checker - 1.1.3 by ShunterAlhena on 05-15-2004 at 05:46 PM

Hi!
I made this small program that can check translations for duplicate hotkeys (i.e. &Change and &Confirm), and inspired by Choli's great Translator I decided to make it commonwealth. I hope that some translators will make good use of it.
I wrote in it .NET since it's the new tool, and supports complex languages as well. There were some other reasons as well, but they are obsolete now ;)
Please let me know what do you think about it.

Current version:
1.1.3 - 17.05.2004 21:00
-Added dropdown list so if a file does not display properly you can adjust encoding. I hope this will be the last bugfix release!;)

1.1.2 - 15.05.2004 21:30 - 37 times
-Fixed: National characters not displaying.

1.0.1 - 15.05.2004 20:00 - 8 times
-Initial release.

Known issues:
-Unlikely to run without .NET Framework (this cannot be fixed, as this is the very essence of .NET applications). Get it from Windows Update (a few megs) or standalone installer (23 megs) from Microsoft.
-Since it uses a general algorithm it will make some false positives, and also miss some mistakes. It would need some kind of "definitions file" for every Plus! version which includes structure of menus etc. It is useful for a crude testing though.


RE: MsgPlus Hotkey Checker - 1.0.1 by ZrednaZ on 05-15-2004 at 06:24 PM

It's nice that someone has finally taken on the job of making an ampersand checker... I find it very hard to do manually. :-)

If it's possible to make a program that checks for ampersand conflicts, wouldn't it also be possible to make a program that sets the ampersands entirely automatic? :D

Btw, it won't display the three Danish characters Æ/æ, Ø/ø and Å/å.

/Zred


RE: MsgPlus Hotkey Checker - 1.0.1 by Leif on 05-15-2004 at 06:54 PM

Great, great, great!! Thanks a lot! This will save me a LOT of work! Judging from Anders', (a.k.a. ZrednaZ) letter, the programme will probably have problems with our Swedish umlauts as well: å/Å, ä/Ä and ö/Ö

Edit: Hmmm... "Could not initiate the programme correctly (0xc0000135). Click on OK to terminate the programme."


RE: MsgPlus Hotkey Checker - 1.0.1 by ShunterAlhena on 05-15-2004 at 06:58 PM

About not displaying characters: Try saving your files with Unicode encoding, then opening them with the program. I have the unicode version of your translations included with Plus! and they display fine.

Leif: Do you have .NET Framework? It is required by all .NET based programs, nothing can be done about it (N). It's Microsoft's official new platform featuring a hell lot of improvements. If VB6 had worked I wouldn't have used this great new technology :(. You can get it from Windows Update or from this link:.NET Framework 1.1 if you have a large bandwidth and wish to download the standalone installer (23 megs). The .NET comes bundled with .NET development apps, Windows Srv 2003 and some office 2003 apps.


RE: MsgPlus Hotkey Checker - 1.0.1 by Patchou on 05-15-2004 at 07:04 PM

Excellent program! however, you should add some internal exceptions for some sections (you can see what I mean by running the program on the english file, it detects some conflicts but some text in the same section can be displayed in different windows/menus that do not conflict with each other).

Thanks for this very useful tool!
Patchou


RE: MsgPlus Hotkey Checker - 1.0.1 by Leif on 05-15-2004 at 07:29 PM

Thanks! .NET Framework and Unicode finally did it! "End of the document reached." :D


RE: MsgPlus Hotkey Checker - 1.1.2 by ShunterAlhena on 05-15-2004 at 07:49 PM

New version: all characters should display without messing with unicode. .NET Framework cannot be fixed, thats a feature not a bug...;)


RE: MsgPlus Hotkey Checker - 1.1.2 by Leif on 05-15-2004 at 09:01 PM

Hmmm... :|
Version 1.1.2 Swedish (ANSI): 9 duplicate hotkeys
Version 1.1.2 Swedish (Unicode): 0 duplicate hotkeys

How come?


RE: MsgPlus Hotkey Checker - 1.1.2 by ShunterAlhena on 05-16-2004 at 06:53 AM

:| It might be that your your national characters look the same  in ANSI but their character codes are different so the prg doesnt consider them same. You could search to one of them and see if some characters looking the same are not found in the search. Anyway, please send me the two files to shunter@freemail.hu :^) (i tested the app many times on my ansi hungarian also full of special characters, and it worked all right...) :$


RE: MsgPlus Hotkey Checker - 1.1.2 by Leif on 05-16-2004 at 11:10 AM

I've tried to mail you my Swedish translation in ANSI and in Unicode but the letters keep bouncing back.

Here is my second letter to you (which also bounced):

"Thanks (again) for a great tool! Some minor nags, though ..
Hotkey Checker flagged these as duplicates. But I intentionally duplicated them. They appear on toggling buttons and this way I can use the SAME hotkey to Play (&Spela) and Stop (&Stoppa) the sound file. And to Play (S&pela) and Stop (Sto&ppa) the other sound file. I thought I was pretty smart there!  :-D
PlayButtonSignin=&Spela
PlayButtonSignout=S&pela
StopButtonSignin=&Stoppa
StopButtonSignout=Sto&ppa"


RE: MsgPlus Hotkey Checker - 1.1.2 by CookieRevised on 05-16-2004 at 11:18 AM

Leif, yeah, that's exactly watch Patchou said in his post:

quote:
Originally posted by Patchou
you should add some internal exceptions for some sections (you can see what I mean by running the program on the english file, it detects some conflicts but some text in the same section can be displayed in different windows/menus that do not conflict with each other).

RE: MsgPlus Hotkey Checker - 1.1.2 by Leif on 05-16-2004 at 11:48 AM

Not exactly. My example is displayed in the same window (and it does not occur in a menu); the text is displayed on a button that toggles between two states. That is the reason I mentioned this particular case. Easy to miss, I thought.


RE: MsgPlus Hotkey Checker - 1.1.2 by ShunterAlhena on 05-16-2004 at 12:10 PM

I'll try to add some "intelligence" to it for such cases, I think it should not be so hard to do with filters.
About bouncing back letters: the freemail.hu server is off line, it keeps breaking down when it was most important. Send it to farkasb@jedlik.hu please, that is my school server. That *should* work.
And thanks for everyone's help!:)


RE: MsgPlus Hotkey Checker - 1.1.2 by CookieRevised on 05-16-2004 at 12:10 PM

yes, it's exactly the same though ;) it is exactly what Patchou means ;)

Anyways, if it could be solved, that would be nice. (I can think of a way/method, much work though because of all the exceptions (and possible changes in the futur)) But if it isn't, then it isn't a big deal IMO. Better safe then sorry ;)

quote:
Originally posted by ZrednaZ
If it's possible to make a program that checks for ampersand conflicts, wouldn't it also be possible to make a program that sets the ampersands entirely automatic?
That would be a very bad idea... This will result in very crappy translations. The ampersand should be placed in a logical manner by a human. For example: "&Cancel Transfer" (first letter in sentence, first letter of main word) or "Cancel &Transfer" and not "Ca&ncel Transfer" (because c and a were already in use?)
RE: MsgPlus Hotkey Checker - 1.1.2 by ShunterAlhena on 05-16-2004 at 07:02 PM

another release, all encoding problem should be fixed now. if the auto detection fails simply switch to unicode encoding.


RE: MsgPlus Hotkey Checker - 1.1.3 by Choli on 05-16-2004 at 08:07 PM

Hey! the idea is good and the program is usefull, however I see problems (as patchou said). There are sections like [IMWindowMenu] that have several levels of menus and so you can repeat shortcut keys and they aren't wrong. There are other sections, like [InstallCommon] where you have 2 buttons that won't be never displayed together ("&Close" and "&Cancell") so they can have the same letter. Also there are values that are used in several menus, (specially in the 3 menus that plus adds to the chat windows (the plus menu, the enhenced one, and the other that is shown when you click the button next to the bolck one :P). I mean, those "&" should be checked with other keys from other sections


well, with all this I don't want you drop the proyect. In fact it's a good program that can be very useful. Continue the great work ;)

quote:
Originally posted by Shunter
Since VB6 had numerous issues concerning Unicode files
I know, but it is possible write a program that handles unicode files (my translator does :P)
quote:
Originally posted by Shunter
and it seems impossible to make it scroll to a certain point in a TextBox or RichTextBox (if someone knows a way, please email me!),
you have a textbox named Text1 and a RichTextBox named RichTextBox1. Both have the text hello . Ok, the next 2 codes do what you want. Exactly, they select the 2 "l" in hello.
code:
Text1.SelStart = 2
Text1.SelLength = 2
Text1.SetFocus
code:
RichTextBox1.SelStart = 2
RichTextBox1.SelLength = 2
RichTextBox1.SetFocus
quote:
Originally posted by CookieRevised
That would be a very bad idea... This will result in very crappy translations. The ampersand should be placed in a logical manner by a human. For example: "&Cancel Transfer" (first letter in sentence, first letter of main word) or "Cancel &Transfer" and not "Ca&ncel Transfer" (because c and a were already in use?)
totally agree ;)
RE: MsgPlus Hotkey Checker - 1.1.3 by Patchou on 05-16-2004 at 08:41 PM

Quick note about VB: Visual Basic works entirely in Unicode internally. I'm not a VB programmer so I can't help you much, however, I can tell you that when VB gives you an ANSI string, that's because it converted it :)


RE: MsgPlus Hotkey Checker - 1.1.3 by ShunterAlhena on 05-17-2004 at 12:30 PM

quote:
Originally posted by Choli
I know, but it is possible write a program that handles unicode files (my translator does )
Yeah, i read a lot about your program and i decided that i'll try .NET instead of APIs....:)

quote:
Originally posted by Choli
Text1.SelStart = 2
Text1.SelLength = 2
Text1.SetFocus
I'm like :o and :|... i spent 2 hours looking for such an expression in MSDN library, with no result... that's when i decided to use .NET. I believed SetFocus is only useful to give a control focus, and the library did not mention that it had a very useful another use...:)
But at least i'm slightly experienced in .NET now, too:D

quote:
Originally posted by Patchou
Quick note about VB: Visual Basic works entirely in Unicode internally.
:o... however with common expressions or using FSO it does not like opening unicode files. there is a ANSI->Unicode conversion function StrConv, and with it i could kick it to life, but the scrolling problem still remained.

Now i see that it was not VB6 that lacked ability, but me ;)
I'll try and make some filters to add some intelligence to the app.
Thanks for all the help!:D
RE: MsgPlus Hotkey Checker - 1.1.3 by Choli on 05-17-2004 at 01:25 PM

quote:
Originally posted by Shunter
Yeah, i read a lot about your program and i decided that i'll try .NET instead of APIs...
If you can program in VB.NET, using it would be easier for you than using VB 6, I think. I wrote the translator in VB.NET because I can't program in .NET and because when I did the first release I hadn't got it yet :P
quote:
Originally posted by Shunter
quote:
Originally posted by Choli
Text1.SelStart = 2
Text1.SelLength = 2
Text1.SetFocus
I'm like :o and :|... i spent 2 hours looking for such an expression in MSDN library, with no result... that's when i decided to use .NET. I believed SetFocus is only useful to give a control focus, and the library did not mention that it had a very useful another use...:)
But at least i'm slightly experienced in .NET now, too:D

the .SetFocus is there to give the textbox the focus so you can see what's selected, because when you create a textbox it has its HideSelection property set to true.
If when you create the textbox you set the HideSelection property to false, you don't need the .SetFocus line ;)
quote:
quote:
Originally posted by Patchou
Quick note about VB: Visual Basic works entirely in Unicode internally.
:o... however with common expressions or using FSO it does not like opening unicode files. there is a ANSI->Unicode conversion function StrConv, and with it i could kick it to life, but the scrolling problem still remained.

Now i see that it was not VB6 that lacked ability, but me ;)
I'll try and make some filters to add some intelligence to the app.
Thanks for all the help!:D
FSO=FileSystemObject? I've never used that and don't know what's that ^o)
and yes, when you open a file, VB reads ansi strings, however it stores them as unicode strings.  That may be a big problem with some files if you open them with the open function. You can work arround that by using APIs.

btw, what has the scrolling thingy to do with ansi/unicode? I don't see any problem with scrolling.
RE: MsgPlus Hotkey Checker - 1.1.3 by ShunterAlhena on 05-17-2004 at 04:18 PM

quote:
Originally posted by Choli
btw, what has the scrolling thingy to do with ansi/unicode? I don't see any problem with scrolling.
Nothing;) Scrolling and encoding were my two main problems in VB6, and i barely could solve one, thats why i said the other one still remained and so i used .NET;)
RE: MsgPlus Hotkey Checker - 1.1.3 by Kian on 05-18-2004 at 08:32 AM

quote:
Originally posted by Shunter
Hi!
I made this small program that can check translations for duplicate hotkeys (i.e. &Change and &Confirm), and inspired by Choli's great Translator I decided to make it commonwealth. I hope that some translators will make good use of it.
I wrote in it .NET since it's the new tool, and supports complex languages as well. There were some other reasons as well, but they are obsolete now ;)
Please let me know what do you think about it.

Current version:
1.1.3 - 17.05.2004 21:00
-Added dropdown list so if a file does not display properly you can adjust encoding. I hope this will be the last bugfix release!;)

1.1.2 - 15.05.2004 21:30 - 37 times
-Fixed: National characters not displaying.

1.0.1 - 15.05.2004 20:00 - 8 times
-Initial release.

Known issues:
-Unlikely to run without .NET Framework (this cannot be fixed, as this is the very essence of .NET applications). Get it from Windows Update (a few megs) or standalone installer (23 megs) from Microsoft.


Is it possible to 'borrow' the source ?
RE: MsgPlus Hotkey Checker - 1.1.3 by ShunterAlhena on 05-18-2004 at 02:46 PM

err... why do you need it? it is extremely uncommon to lend sourcecodes;)


RE: RE: MsgPlus Hotkey Checker - 1.1.3 by Kian on 05-18-2004 at 03:42 PM

quote:
Originally posted by Shunter
err... why do you need it? it is extremely uncommon to lend sourcecodes;)


Well it was just a question and if you don't want to share your source :D its okay... I just wanted to see how you did



// Peter aka Kian aka Peter
Another of those stupid Danes
RE: MsgPlus Hotkey Checker - 1.1.3 by CookieRevised on 05-19-2004 at 05:21 AM

Something like this I presume:

1) search and read for a ini-topic
  2) read an (string) ini-values of a that ini-topic.
    3) search where the ampersand is in the string
    4) compare it with the ampersands in the array
    5) if not found, store it in the array
    6) if found, show it
  7) repeat from (2) until you got all ini-values of a certain ini-topic
  8) clear the array.
9) proceed with the next topic (1) until every topic has been handled

10) print "hello world" :D


RE: MsgPlus Hotkey Checker - 1.1.3 by ShunterAlhena on 05-19-2004 at 02:19 PM

Well, almost.
1, Read next character
2, If character is "]", clear collision array
3, If character is linebreak:
   3a, Check next character
   3b, If next character is linebreak, clear collision array
4, If character is "&":
   4a, Check next character
   4b, If not Space or &,
       4ba, If already in collision array, stop
       4bb, If not in collision array, add
5, If no next character, print "y0 y0 y0"


RE: MsgPlus Hotkey Checker - 1.1.3 by CookieRevised on 05-19-2004 at 05:13 PM

quote:
Originally posted by Shunter
2, If character is "]", clear collision array
3, If character is linebreak:
   3a, Check next character
   3b, If next character is linebreak, clear collision array
I didn't test this, but this explaination seems a bit dodgy if it realy happens like I read it...
A) you're only test for a new topic is "]" somewhere in a line?
B) linebreaks? you shouldn't let the code depend on linebreaks at all...



EDIT: I tested it with this file, and my assumptions are correct...
code:
[topic1]
key11=h&ello world
key12=[test]
key13=mor&e text

[topic2]
key21=yep th&is is topic number 2

key22=and mambo number f&ive

This is a valid INI file... As you can see your program doesn't reconize double apersands in both topics...

First, A new topic is ALWAYS started at a new line not in the middle of a line. For example, the value from key12 ([test]) isn't a new topic, it is a valid value for a key....
Also, remember that spaces in front of keys and spaces in front and behind a topic should be ignored. The following file is exact the same INI-file, and should be handled just the same (note I replaced the spaces with points so you can see them clearly):
code:
......................
............[topic1].................
.......key11=h&ello world
key12=[test]
............key13=mor&e text..........
.......
...[topic2]

...........................key21=yep th&is is topic number 2
...............................
........key22=and mambo number f&ive
(also note that the value of key13 is "mor&e text.........." in this case and not "mor&e text")

Second, linebreaks in a INI-file can occur everywhere, key21 and key22 are still part of topic2...  checking on linebreaks to check topics is a big no-no...

So,

How to detect a new topic (without the use of API's):
in pseudocode: TRIM(readline) == "[?*]"
- readline is the variable which holds the new textline read from the ini-file.
- TRIM is to strip the line from leading and trailing spaces
- [?*] means: starting with "[", then some text (at least 1 character), ending with "]"
This is the ONLY valid way. If the above function returns true, then, and only then, you have a new topic...

PS: Lines you should ignore (AFTER removing leading and trailing spaces!): empty lines and lines starting with ";"

;)


RE: MsgPlus Hotkey Checker - 1.1.3 by ShunterAlhena on 05-19-2004 at 06:49 PM

quote:
Originally posted by CookieRevised
[topic2]
key21=yep th&is is topic number 2

key22=and mambo number f&ive
<=:D

You are right about the ] checking, it is a very inelegant way to handle that. As soon as this exam-heated week goes away I'll code filters and correct this as well. (although if you look in the file, you'll find no messages with ] in them. After all this program was written for Messenger Plus!, not for generic INI files;))
But newline checking was not used for nothing: for example look at this

InsertSpecialTag=Insert &Special Tag
CurrentTime=Current &Time\t(!T)
CurrentDate=Current &Date\t(!D)
MyName=My &Name\t(!NP)
MyEmail=My &E-mail\t(!MP)
ContactNames=&Contact Name(s)\t(!N)
ContactEmails=C&ontact Email(s)\t(!M)
CustomContactNames=C&ustom Contact Name(s)\t(!CN)
CurrentIP=Current &IP\t(!IP)
SoftwareVersion=Software &Version\t(!VER)
PluginsVersion=Plugins Ve&rsion\t(!PVER)
Winamp=&Winamp Song Title\t(!WAT)

InsertFormatTag=Insert &Format Tag
BoldText=B&old Text\t(!FB)
ItalicText=&Italic Text\t(!FI)
UnderlinedText=&Underlined Text\t(!FU)
StrikedoutText=&Struck-out Text\t(!FS)
TextColor=Text &Color\t(!FC)
TextBckColor=Text &Background Color\t(!FG)
ResetFormat=&Reset Format\t(!FR)

(extract from DefaultLg, section IMWindowMenu)
These are in the same section, although the ampersands do not collide (the two menus are not displayed at the same time). Until filters are set up i found newline checking as an alternate solution to stop (at least reduce) false collisions.
RE: MsgPlus Hotkey Checker - 1.1.3 by CookieRevised on 05-19-2004 at 11:20 PM

quote:
Originally posted by Shunter
although the ampersands do not collide (the two menus are not displayed at the same time). Until filters are set up i found newline checking as an alternate solution to stop (at least reduce) false collisions.
You realy shouldn't use that method, as the translation files are generic INI-files (and the method I described is in fact as long/short as the one you used).

Not all translations will have those line breaks or will have linebreaks at different places. For example the dutch translation uses a different order for the keys then the default English one. And there are many languagefiles which don't have empty lines between the topics at all.

In fact, in the current default English translation (first two lines of your example):
InsertSpecialTag=Insert &Special Tag
CurrentTime=Current &Time\t(!T)

can have the same ampersand because CurrentTime is a child menu of InsertSpecialTag. So even your current method doesn't work!....


PS: about the ], you're right, it isn't used (yet)... but who says no one can use [ and ] instead of ( and ) for example in a translation? example: the key strokes in IRC style shortcuts, someone could use "[ctrl]+[b]" for example (which is another common way of writing keystrokes, and there are more examples to give...)

PSS: saying: let's make a program to check the ampersands is simply at first sight, but in fact isn't as easy as that...


Anyway, I forgot that you guys and girls have exams ;) that's priority of course.... and btw, very good luck with them... ;)
RE: MsgPlus Hotkey Checker - 1.1.3 by Choli on 05-20-2004 at 10:44 AM

quote:
Originally posted by CookieRevised
PS: about the ], you're right, it isn't used (yet)... but who says no one can use [ and ] instead of ( and ) for example in a translation? example: the key strokes in IRC style shortcuts, someone could use "[ctrl]+[b]" for example (which is another common way of writing keystrokes, and there are more examples to give...)

just now (at the uni) I don't remember, but I think we've put (or had put and now changed) a value between [ ] in the spanish_spain so you have to be careful with those things ;)
RE: MsgPlus Hotkey Checker - 1.1.3 by ShunterAlhena on 05-20-2004 at 06:38 PM

as soon as the goddamn german exam is ok i'll see to it;)