Slides de la Localisation

17
Localisation d’applications

description

 

Transcript of Slides de la Localisation

Page 1: Slides de la Localisation

Localisation d’applications

Page 2: Slides de la Localisation

•Plus de clients•Meilleure expérience utilisateur

Pourquoi localiser ?

19 %

18 %

17 %8 %8 %

7 %Irlande Belgique GrèceEspagen Autriche TaiwanRussie Turquie ChiliEquateur Malaisie SalvadorAustralie Danemark PortugalPays Bas Italie AllemagneSuisse Japon FranceUSA Royaume Uni

Page 3: Slides de la Localisation
Page 4: Slides de la Localisation
Page 5: Slides de la Localisation

Internationalisation

•NSNumberFormatter

- (NSString *)stringFromNumber:(NSNumber *)number

$1,000.00 1 000,00 $

Page 6: Slides de la Localisation

•NSDateFormatter

Internationalisation

- (NSString *)stringFromDate:(NSDate *)date

- (void)setDoesRelativeDateFormatting:(BOOL)b

+ (NSString *)dateFormatFromTemplate:(NSString *)template options:(NSUInteger)opts locale:(NSLocale *)locale

NSDateFormatter * dateFormatter = [[[NSDateFormatter alloc] init] autorelease];NSString * dateComponents = @"yMMMMd";NSString * dateFormat = [NSDateFormatter dateFormatFromTemplate:dateComponents options:0 locale: [NSLocale currentLocale]];[dateFormatter setDateFormat:dateFormat];

!!"#$%&'&

!

September 9, 2010 9 Septembre 2010

Page 7: Slides de la Localisation

Processus de localisation

•Préparer la localisation•Traduire•Ajuster les élements d’interface

Page 8: Slides de la Localisation

Localisation

•Fichiers .strings

•Stockés sous forme key/value

•Accessibles avec :

"clé" = "valeur";

NSLocalizedString(@"Key", @"Localization hint");Fichier Localizable.strings

Encodage UTF-16

Page 9: Slides de la Localisation

•Outil pour scanner et produire un fichier .strings

• Insère les commentaires trouvés dans le code

•Accessible avec :genstrings ./*.m

NSLocalizedString(@"Key", @"Localization hint");

/* Localization hint */"Key" = "Clé";

genstrings

Page 10: Slides de la Localisation

XIBs localisés

Page 11: Slides de la Localisation

Démo

Page 12: Slides de la Localisation

•Utiliser des images le plus souvent possible

Recommendations

•Utiliser les variables “%1$@” pour permettre un ordre différent

/* Message in alert panel when something fails */"Oh %@! %@ failed!" = "%2$@ blah blah, %1$@ oh!";

Page 13: Slides de la Localisation

•Formattage des strings

NSLocalizedString(@"reversedDomainStyleKey", @"'English translation' and localization hint");

/* 'English translation' and localization hint */"reversedDomainStyleKey" = "reversedDomainStyleKey";

Recommendations

/* 'Enter passcode' text when unlocking the application */"passCodeUnlockEnterPassCode" = "Saisissez le code";

/* 'Wrong passcode' text when unlocking the application */"passCodeUnlockWrongPassCode" = "Code erroné";

/* 'Numeric keypad' in the settings */"settingsNumericKeypad" = "Clavier numérique";

/* 'Enter Decimals Automatically' in the settings */"settingsNumericKeypadEnterDecimalsAutomatically" = "Décimales automatiques";

/* 'Use Decimal Key' in the settings */"settingsNumericKeypadUseDecimalKey" = "settingsNumericKeypadUseDecimalKey";

Page 14: Slides de la Localisation

Eviter de localiser les XIBs•Maintenance difficile

Localiser dans le code•Traduire les labels, boutons, etc...•Ajuster les élements d’interface

Recommendations

Avantages•Résultat immédiat pour les traducteurs sous OS X•Taille de l’application réduite

Page 15: Slides de la Localisation

- (void)loadView {! [super loadView];!! [self sq_localizeControls];! [self sq_layoutViewControls];}

- (void)sq_localizeControls {! accountsHistoryLabel.stringValue = NSLocalizedStringFromTable(@"accountsHistoryLabelTitle", @"PreferencesCharts", @"'Accounts history:' title of the corresponding label");!! graphTypeLabel.stringValue = NSLocalizedStringFromTable(@"graphTypeLabelTitle", @"PreferencesCharts", @"'Graph type:' title of the corresponding label");! [graphTypePopUpButton addItemWithTitle:NSLocalizedStringFromTable(@"graphTypePopUpButtonBalanceHistoryItemTitle", @"PreferencesCharts", @"'Balance history' title of the menu item to display the balance history in the history graph")]; @"PreferencesCharts", @"'Activate rotation' title of the checkbox button to activate the Z-axis rotation of the history graph");

...}

NSLocalizedStringFromTable(@"Key", @"Table", @"Localization hint");

Recommendations

Page 16: Slides de la Localisation

!- (void)sq_layoutViewControls {

...

// Percentages button! [displayPercentageButton sizeToFit];! NSRect displayPercentageButtonFrame = displayPercentageButton.frame;! displayPercentageButtonFrame.origin.x = borderMargin + 20;! displayPercentageButton.frame = displayPercentageButtonFrame;}

- sizeToFit;

Recommendations

iOS

OS X

@property(nonatomic) BOOL adjustsFontSizeToFitWidth;

- sizeToFit;

(UITextField & UILabel)

(NSControl)

(UIView)

Page 17: Slides de la Localisation

Recommendations

Vos traducteurs

•Laissez-les vous contacter•Uniquement des natifs•Vérifiez leur «CV»• Intégrez-les à vos béta testeurs