What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Translation » MsgPlus Hotkey Checker - 1.1.3

Pages: (3): « First « 1 2 [ 3 ] Last »
1 votes - 5 average   MsgPlus Hotkey Checker - 1.1.3
Author: Message:
Kian
Full Member
***

Avatar

Posts: 133
42 / Male / –
Joined: Mar 2003
RE: MsgPlus Hotkey Checker - 1.1.3
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 ?
lets get one thing straight - i am NOT
05-18-2004 08:32 AM
Profile PM Web Find Quote Report
ShunterAlhena
Junior Member
**

Avatar
Magyar (Hungarian) Translator

Posts: 74
36 / Male / –
Joined: Jul 2003
O.P. RE: MsgPlus Hotkey Checker - 1.1.3
err... why do you need it? it is extremely uncommon to lend sourcecodes;)
:deal: Translators: view Hotkey Checker here.
(Gives some false positives, but usable for a crude automatic testing.)
05-18-2004 02:46 PM
Profile E-Mail PM Web Find Quote Report
Kian
Full Member
***

Avatar

Posts: 133
42 / Male / –
Joined: Mar 2003
RE: RE: MsgPlus Hotkey Checker - 1.1.3
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
lets get one thing straight - i am NOT
05-18-2004 03:42 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: MsgPlus Hotkey Checker - 1.1.3
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
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-19-2004 05:21 AM
Profile PM Find Quote Report
ShunterAlhena
Junior Member
**

Avatar
Magyar (Hungarian) Translator

Posts: 74
36 / Male / –
Joined: Jul 2003
O.P. RE: MsgPlus Hotkey Checker - 1.1.3
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"
:deal: Translators: view Hotkey Checker here.
(Gives some false positives, but usable for a crude automatic testing.)
05-19-2004 02:19 PM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: MsgPlus Hotkey Checker - 1.1.3
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 ";"

;)


This post was edited on 05-19-2004 at 05:38 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-19-2004 05:13 PM
Profile PM Find Quote Report
ShunterAlhena
Junior Member
**

Avatar
Magyar (Hungarian) Translator

Posts: 74
36 / Male / –
Joined: Jul 2003
O.P. RE: MsgPlus Hotkey Checker - 1.1.3
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.

This post was edited on 05-19-2004 at 06:54 PM by ShunterAlhena.
:deal: Translators: view Hotkey Checker here.
(Gives some false positives, but usable for a crude automatic testing.)
05-19-2004 06:49 PM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: MsgPlus Hotkey Checker - 1.1.3
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... ;)

This post was edited on 05-25-2004 at 12:51 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
05-19-2004 11:20 PM
Profile PM Find Quote Report
Choli
Elite Member
*****

Avatar
Choli

Posts: 4714
Reputation: 42
43 / Male / Flag
Joined: Jan 2003
RE: MsgPlus Hotkey Checker - 1.1.3
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 ;)
Messenger Plus! en espaņol:
<< http://www.msgpluslive.es/ >>
<< http://foro.msgpluslive.es/ >>
:plus4:
05-20-2004 10:44 AM
Profile PM Find Quote Report
ShunterAlhena
Junior Member
**

Avatar
Magyar (Hungarian) Translator

Posts: 74
36 / Male / –
Joined: Jul 2003
O.P. RE: MsgPlus Hotkey Checker - 1.1.3
as soon as the goddamn german exam is ok i'll see to it;)
:deal: Translators: view Hotkey Checker here.
(Gives some false positives, but usable for a crude automatic testing.)
05-20-2004 06:38 PM
Profile E-Mail PM Web Find Quote Report
Pages: (3): « First « 1 2 [ 3 ] Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On