J'ai cette chaîne formatée sur laquelle travaille un traducteur.Localisation avancée avec omission d'arguments dans Xcode
ANGLAIS
"Check out the %[email protected] %[email protected] in %[email protected]: %[email protected]" = "Check out the %[email protected] %[email protected] in %[email protected]: %[email protected]"
TRADUCTION ALLEMAND
"Check out the %[email protected] %[email protected] in %[email protected]: %[email protected]" = "Hör Dir mal %[email protected] in %[email protected] an: %[email protected]";
Ceux-ci sont transmis à un appel [NSString stringWithFormat:]
:
//////////////////////////////////////
// Share Over Twitter
NSString *frmt = NSLocalizedString(@"Check out the %[email protected] %[email protected] in %[email protected]: %[email protected]", @"The default tweet for sharing sounds. Use %[email protected] for where the sound type (Sound, mix, playlist) will be, %[email protected] for where the audio name will be, %[email protected] for the app name, and %[email protected] for where the sound link will be.");
NSString *urlString = [NSString stringWithFormat:@"sounds/%@", SoundSoundID(audio)];
NSString *url = ([audio audioType] == UAAudioTypeSound ? UrlFor(urlString) : APP_SHORTLINK);
NSString *msg = [NSString stringWithFormat:
frmt,
[[Audio titleForAudioType:[audio audioType]] lowercaseString],
[NSString stringWithFormat:@"\"%@\"", AudioName(audio)],
APP_NAME,
url];
returnString = msg;
Avec le choix et le résultat réel de:
ANGLAIS
desired: "Check out the sound "This Sound Name" in My App Name: link_to_sound" actual: "Check out the sound "This Sound Name" in My App Name: link_to_sound"
ALLEMAND
desired: "Hör Dir mal "This Sound Name" in My App Name an: link_to_sound" actual: "Hör Dir mal sound in "This Sound Name" an: My App Name"
LE PROBLÈME Le problème est que je suis sous l'hypothèse qu'en utilisant la variable numérotée dans la -[NSString stringWithFormat:]
, Je pourrais faire ça ngs comme ceci, où la variable %[email protected]
est complètement omise. Si vous remarquez, la traduction allemande de la chaîne de format n'utilise pas le premier argument (%[email protected]
) mais elle ("son") apparaît toujours dans la chaîne de sortie.
Qu'est-ce que je fais mal?
il semble que ce que je faisais mal est de faire une hypothèse sur l'omission de variables numérotées. – coneybeare
Il est intéressant que cela fonctionne bien dans Android/Java; doit être leur implémentation (invalide?) – Opus1217