[Kde-games-devel] KScoreDialog and KGameDifficulty bugs

Matt Williams matt at milliams.com
Mon Apr 28 23:55:38 CEST 2008


On Monday 28 April 2008 21:42:15 Matt Williams wrote:
> On Monday 28 April 2008 21:39:45 Matt Williams wrote:
> > 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
>
> Crap, forgot to attach the patch. Here we go...
>
> Matt

Albert pointed out that I'd missed some addLocalizedConfigGroupName() calls in 
the ksquares part of the patch. Here's an updated patch with the correct 
calls being made.

Regards,
Matt Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: i18nfixforkscoredialog.patch
Type: text/x-diff
Size: 15593 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20080428/850b1501/attachment-0001.bin 
-------------- 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/850b1501/attachment-0001.pgp 


More information about the kde-games-devel mailing list