Slides de la Localisation

Preview:

DESCRIPTION

 

Citation preview

Localisation d’applications

•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

Internationalisation

•NSNumberFormatter

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

$1,000.00 1 000,00 $

•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

Processus de localisation

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

Localisation

•Fichiers .strings

•Stockés sous forme key/value

•Accessibles avec :

"clé" = "valeur";

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

Encodage UTF-16

•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

XIBs localisés

Démo

•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!";

•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";

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

- (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

!- (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)

Recommendations

Vos traducteurs

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