[Kde-games-devel] KScoreDialog and KGameDifficulty bugs

Matt Williams matt at milliams.com
Mon Apr 28 22:39:45 CEST 2008


On Sunday 27 April 2008 23:05:29 Matt Williams wrote:
> On Sunday 27 April 2008 22:36:48 Matt Williams wrote:
> > On Sunday 27 April 2008 20:12:52 Matt Williams wrote:
> > > Hey everyone,
> > >
> > > I went through my KScoreDialog bugs trying to track down the reasons
> > > for them. Most of the bugs were related to i18n which is often a cause
> > > for confusion for me :)
> >
> > <snip>
> >
> > After some more discussion with Albert, I'm rewriting the patch to change
> > everything to use KLocalizedString. This will make everything a lot less
> > hacky. Stay tuned...
>
> Well KLocalizedString seemed very promising as a way of solving all this
> mess but there's a small problem. When retrieving the group names from the
> config files, there's no longer any way to get at the translations. This is
> particularly difficult for those which were translated with context since
> all the context is lost when saved to file. It worked before since the
> string could be read from the file and passed to the i18n() which would
> simply do a string lookup (hence the I18N_NOOP()'s in the last patch).
>
> Albert, got any bright ideas? :)

Well it turned out he did :) The solution we came up with is, after creating 
the KScoreDialog object, to explicitly add translations (by passing a 
KLocalizedString) for all the possible group names. When the class comes to 
read the config file, it can compare the untranslated string in the file with 
the untranslated string from the list of KLocalizedStrings and extract the 
localised string hence.

I've had to add 2 functions to KGameDifficulty. One which returns the 
KLocalizedString for the currently active difficulty level and another which 
returns a full list of all the difficulty levels' KLocalizedStrings.

Once again the patch updates KMines, KSquares, Kollision and KNetwalk but 
leaves the rest of the games alone. I'll update the others myself if this 
patch is okay.

When I come to rewrite KScoreDialog (for 4.2) it will need to be treated in 
this way too but will rock twice as hard (at least)!

Comments?

Regards,
Matt Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20080428/1228be2b/attachment-0001.pgp 


More information about the kde-games-devel mailing list