Živijo, najprej en zelo velik hvala za povezavo na tisti gettext ...
On 10/11/07, Primoz PETERLIN wrote: > Zdravo, > > Če bi pisala program samo za slovenščino, je shema naslednja: > > if (n % 100 == 1) > edninska oblika (npr. datoteka) > else if (n % 100 == 2) > dvojinska oblika (npr. datoteki) > else if ((n % 100 = = 3) || (n % 100 == 4)) > 1. množinska oblika (npr. datoteke) > else > 2. množinska oblika (npr. datotek) To mi je jasno, samo ... > Če pa ga pripravljaš na lokalizacijo, pa je stvar na splošno bolj zapletena. > Nekaj zgledov je navedenih v < > http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html> > > Lep pozdrav, Primož Kako lokalizirati v primerih, ko program ni pisan z gettext-om? http://developer.apple.com/documentation/MacOSX/Conceptual/BPInternational/BPInternational.pdf Malo sem brskala po izvorni kodi programa: if (abbreviate) { //Note: after checking with a linguistics student, it appears that we're fine leaving it as w, h, etc... rather than localizing. weeksString = [NSString stringWithFormat: @"%iw",weeks]; daysString = [NSString stringWithFormat: @"%id",days]; hoursString = [NSString stringWithFormat: @"%ih",hours]; minutesString = [NSString stringWithFormat: @"%im",minutes]; secondsString = [NSString stringWithFormat: @"%.0fs",seconds]; } else { weeksString = (weeks == 1) ? ONE_WEEK : [NSString stringWithFormat:MULTIPLE_WEEKS, weeks]; daysString = (days == 1) ? ONE_DAY : [NSString stringWithFormat:MULTIPLE_DAYS, days]; hoursString = (hours == 1) ? ONE_HOUR : [NSString stringWithFormat:MULTIPLE_HOURS, hours]; minutesString = (minutes == 1) ? ONE_MINUTE : [NSString stringWithFormat:MULTIPLE_MINUTES, minutes]; secondsString = (seconds == 1) ? ONE_SECOND : [NSString stringWithFormat:MULTIPLE_SECONDS, seconds]; } Kjer je eden od primerkov: #define MULTIPLE_SECONDS AILocalizedStringFromTableInBundle(@"%1.0lf seconds", nil, [NSBundle bundleWithIdentifier:AIUTILITIES_BUNDLE_ID], nil) in potem ponovno spraševala avtorja, od kogar sem dobila tale "pomirjujoči" odgovor: In Cocoa, it's a very unelegant solution. You simply have two strings, such as "Online for 1 hour" and "Online for %i hours". You do a check in the code for how many hours there are, and if it's more than 1 you use the second of those two strings which has the typical plural formation. That good stuff from gettext simply can't be done in Cocoa unless using gettext. Adium itself doesn't use gettext, though some of the libraries such as libpurple do (so that's where you may have seen it used in terms of Adium). Cocoa doesn't provide for any sort of fuzzy string matching, smart plural translations, or anything like that, unfortunately. ... right now, they couldn't be used, but some other work in progress (with a goal of getting Voice & Video chat in Adium, actually) would make gettext code usable from other parts of Adium. Once that's done, the question would be worth revisiting as to whether we could use ngettext or dngettext for strings with plurals like that. It definitely would require at least some code rewriting and isn't possible right now, but as I mentioned it might be in the future. For now, we'll have to deal with the non-optimal translations forced by having one-or-many setups for translations, as many applications do... but I'd be open to patches toward making translation better and would be willing to look at it again at some point :) --------- Torej bo treba na lepše in pravilnejše oblike še malo počakati ... Hvala še enkrat, Mojca > 10.10.07 je Mojca Miklavec < [EMAIL PROTECTED]> napisal/-a: > > > > Živijo, > > > > Programerja nekega Mac programčka (spisanega v Cocoi [se oproščam, ker > > ne znam sklanjat]) sem vprašala, kako naj prevajam množinske oblike > > samostalnikov oz. če bi se dalo program tako prilagoditi, da bi bilo > > to možno. Odgovoril mi je sledeče: > > > > > Unfortunately, Cocoa doesn't have GNU gettext's ability to handle > > > plurals and multiple-various plurals.... I don't know of any way to > > > fix the numbering situation :( I'm open to suggestions, though... GNU > > > gettext's documentation even specifically mentions that if the output > > > form is a Cocoa-style strings file, plurals aren't supported, which is > > > consistent with that understanding. > > > > Ima kdo kakšno idejo? (Če bi Slovenec pisal program, bi najbrž napisal > > nekaj if-stavkov - naj se potem tujci mučijo s prevajanjem enakih > > nizov :) > > > > Hvala, > > Mojca _______________________________________________ lugos-slo mailing list [email protected] http://liste2.lugos.si/cgi-bin/mailman/listinfo/lugos-slo
