Re: Some questions about placeholders and markers in translations
Marko Lindqvist <[email protected]> Sat, 9 Apr 2022 23:19:06 +0300
| Newsgroups | gmane.games.freeciv.internationalization |
|---|---|
| Message-ID | <CAF6bG8eAok1cy+1m0AVaYOrNSdiguqA=Gz5SY-2BWo0vqxkyVA@mail.gmail.com> |
Those SHOULD be answered in http://www.freeciv.org/wiki/Localization but I notice that some are not. On Sat, 9 Apr 2022 at 22:32, Mathias (GER, Freeciv) <[email protected]> wrote: > > Hi all, > > today I spent a few hours translating. I found some things that I don't understand e.g. placeholders (%s or %d) and other markers (underscores, round brackets oder questions marks): > > – What are these placeholders and markers for? > – How must they be used in translations? > – What rules / syntax must be observed? > > Maybe someone can explain this to me or tell me where I can find answers. Here are some examples: > > - - - - - > > Percentage signs > Examples: > %s %s gets replaced by relevant String. There could be "%s makes %s translation", from which then come both -> "Mathias makes German translation" -> "Marko makes Finnish translation" > (In some cases, multiple %s are used in one "Language constant") I'd call them just the opposite: "Language variables". > %d Number > %3d Number, but always with at least 3 digits -> "002" > Plague risk: %.1f%% Floating point number followed by percent sign (%% -> %) You can simply place those same markings to your translation in the same order than in the English original, but it's also possible to have them in different order: http://www.freeciv.org/wiki/Localization#How_to_change_the_order_of_arguments > %1 > %2 etc. While these look like C parameters above, these are Qt's (with which Qt-client and ruledit have been made) own string handling stuff. The number just indicates the order or arguments. > Underscores > Examples: > _Mines > U_nload All From Transporter In some guis, the character following the underscore is a mnemonic (i.e. if these are in the menu, you can quickly access "Unload" by pressing 'n') Otherwise the underscore is not shown to user. > Round brackets > Example: > (unknown city) No special meaning. Probably used in a place where normally would be a city name, but for some reason we cannot show it now. > Question marks and asterisks > Examples: > ?redundant:* > ?Merchant:M > ?timeout:eta > ?style:European Those are qualified strings: http://www.freeciv.org/wiki/Localization#How_to_handle_qualified_translatable_strings > "Language constant" without blank spaces > Examples: > RequiresBridge > PreventsOtherRoads > CanIrrigate > CanRoad At least all your examples are names of some flags in the ruleset format (if a road type has RequiresBridge flag, it cannot be built on river tile without knowing Bridge Building). Usually these are not shown to users (so translation is not a high priority), but there are theoretical cases where some custom ruleset could cause them to appear in help. - ML