27
@valeriecodes Finding Translations Adventures in localization and internationalization

Finding Translations: Localization and Internationalization in Rails

Embed Size (px)

Citation preview

Finding TranslationsAdventures in localization and internationalization

@valeriecodes

Defining our termsLocalization - the process of adapting internationalized software for a specific region or language by adding locale-specific components and translating textInternationalization- the process of designing a software application so that it can potentially be adapted to various languages and regions without engineering changes

Thanks, Wikipedia!

@valeriecodesInternationalization is the process of setting up your app in a way that it can be localized, whereas localization is the actual process of adapting your app for use in other locales, including translation, distance and time conversions, and different feature sets.

In plain EnglishTranslating (and getting ready to translate) your app.

@valeriecodes

What is translation?Language-English to French, French to Arabic, English to German, Swahili to Esperanto, Spanish to CantoneseCultural-British to American, Portuguese to Brazilian, Canadian to AustralianRegister-Formal to informal, professional to Twitter, AP style to MLA style

@valeriecodesMostly touching on first typeOther aspects of second type: measurement, government/legal terms, dialect differencesTranslators should be aware of third typeMaybe you could use some of the same toolsE.G. kid and parent versions of site

Who Am I?24601

Valerie Woolard@valeriecodesRails developer at PanoplyInterests in linguistics, translation, and languagePast life as a French major

@valeriecodes

So you want to localize your app...

@valeriecodes

When should you think about localization?Now.

Think about your app and its possible audience. If your set of possible users is not a subset of US-based English speakers, localization is something that should be on your radar.

@valeriecodesEven if you dont see a future where your app is localized, writing it with localization in mind will lead you to other good practicesVery few things are just going to be tailored to just English speakers, esp. Considering how many languages are spoken in the US

When should you internationalize?Before you need to. (Now.)Dont hard code strings into your views, use keys!

@valeriecodesConverting strings in your views to keys is an easy win that you can do RIGHT NOW

Rails localization conventionsGuide: http://guides.rubyonrails.org/i18n.htmlTranslate vs. localize.yml files everywhereTheres a lot built in for you

@valeriecodesTranslate: language (what language does this person speak?)Localize: measurement, etc. (where is this person from?)By default rails uses yml files, well talk more about this later

But this gets annoying fast

@valeriecodesThink about the scale of your app and how many strings youre likely to needHundreds? Thousands?At what point is it practical to store everything in yml?Customize yml files to be per-feature

Theres a gem for thatrails-i18nLocaleappGlobalizeGeocoderi18n-tasks

@valeriecodesRails-18n - translations for errors- activerecord stuff- date formatting- much moreLocaleapp: webapp for storing translationsProvides interface for translators to log in fromAlso tied into paid translation servicesGlobalize Adds translations to ActiveRecord modelsLocalize attributesIf you have a blog with posts that need localized versionsGeocoderLocation-based locale selectionI18n-tasksReport keys that are missing or unused.Pre-fill missing keys, optionally from Google Translate.Remove unused keys.

Redis-based solutionhttp://railscasts.com/episodes/256-i18n-backendsOther possible database backends?

@valeriecodesActiveRecord also possibleFrequency of accessIn-memory store probably preferableCaching issues

Or just edit the YMLThe usual wayOr in a graphical YML editor

@valeriecodes

Things to considerWhat needs to be translated?Page titles?Model attributes?Large blocks of text?Lots of strings?Special characters?Who is translating it and what tools do they need?Contextual informationA nice GUI?

@valeriecodes

Here be dragons

@valeriecodesAny time youre translating fragments or concatenating translated strings together, take a step back

The parade of foolish assumptions

@valeriecodes

Fragments can be translated with accuracy

@valeriecodesDifferent syntaxVerb may go at end of sentenceFull sentence may be needed for conjugating/genderingInstead, use variables in a full sentence to drop in your own textVariable can be passed in with locale key

Pluralization works the same in other languages

More on pluralization rules: http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html

@valeriecodesEnglish:- zero & more than 1- 1Other languages may make different distinctionsDont hard code thisInstead, use the count variable

Other languages use the same level of specificity

@valeriecodesGenderRegister (formal/informal)Context/specificity of wordKorean has multiple words for in--one to denote a snug fit in a container, one to denote a loose fit

A message can be conveyed in another language in the same space

@valeriecodesSome languages may use far less or more space to convey the same informationFit more characters in a space or adding a line, shrinking textFixed height/width containersThink about this when writing CSS/doing frontend workGeneral rule of thumb in English to French translation: French text will always take up more space

The flow of text will always be left-to-rightLeft-to-right/Right-to-left

@valeriecodes

The character set will always be the Roman alphabet

@valeriecodes

Holy merge conflicts, Batman!

@valeriecodesIf everything is in one yml file, things get messy quickWith everyone modifying a single yml file, merge conflicts are likelyYou also probably dont want to give everyone who wants to change copy repo accessBreak up keysSubmoduleDatabaseSeparate repoLocaleapp/other external source of truth

Concerns:- Ease of use- Audit trail- Ease of rollback- File size/complexity

But how does your app translate?Think about cultural and legal implications and differences when choosing how to localize and what countries and languages to localize forPrivacyLegal issuesCultural differences

@valeriecodesBefore you decide to internationalize for a given region, think about all these things- Other countries have different norms around privacy, religion, tracking- There may be legal issues, do not track, copyright, defamation- The same needs may not exist: healthcare, transport- Social and cultural differences: attitudes toward gay people, etc.

Key takeawaysThink about localization nowYour translators should have a good understanding of your appTranslation is hardKnow your audience

@valeriecodesBefore you decide to internationalize for a given region, think about all these things- Other countries have different norms around privacy, religion, tracking- There may be legal issues, do not track, copyright, defamation- The same needs may not exist: healthcare, transport

Questions?

@valeriecodes

Get in [email protected]://valerie.codesGithub: valeriecodesTwitter: @valeriecodes

@valeriecodes