From kde-pim Mon Jul 12 09:34:22 1999 From: Don Sanders Date: Mon, 12 Jul 1999 09:34:22 +0000 To: kde-pim Subject: Re: Addressbook UI X-MARC-Message: https://marc.info/?l=kde-pim&m=93177208102716 On Fri, 09 Jul 1999, Rik Hemsley wrote: > On 09-Jul-99 Don Sanders wrote: > > Another problem I have is that I have long lists of strings defined in my > > code. > > I'm wondering what the proper method of dealing with them is. At the moment I > > have a > > > > QString blaa[] = { > > "a", "b", "c", "" > > }; > > > > and a > > > > for(int i = 0; blaa[i] != ""; ++i) > > dosomething( i18n( blaa ); > > > > surely there is a better way, yes? > I'm concerned about having i18n(variable). I don't know how i18n() works but I > wonder whether translation will actually work unless you do i18n("string"). Exactly. Oh well I'll append looking into it further onto my todo list. > > Even nastier I have lists like > > > > QString title[] = { > > "Mr.", "Miss", "Mrs.", "Prof" > > }; > > > > Which may well be locale dependent. (I guess different cultures might not > > have > > an equivalent to Miss or may have more titles than English speakers do) How > > do I > > handle this in a locale independent way? > > I think this might work: > Pick a number of titles. Define what they mean. Make the Combo editable > so anyone can add their own. This way, you can do something like this: > > # 1 = Male 2 = Unmarried female 3 = Married female 4 = Married/Unmarried female > # (polite form) 5 = Person with PhD >5 = Anything else > > const QString titles = i18n("1,Mr,2,Miss,3,Mrs,4,Ms,5,Dr"); > > You can then parse the list and map the correct titles. > > The French version might look something like this (I don't know the contracted > forms or the word for doctor) > > "1,Monsieur,2,Mademoiselle,4,Madame,5,Dr" > > You can then add only those which are defined. > > This is a little odd. Perhaps there's a better way. This looks fine, I don't actually need numbers though just a comma separated list of values. Actually after having discussed this a bit it might not be a problem in reality. BFN, Don.