RubyConf AU 2017
Finding Translations, Localisation and Internationalisation

http://www.rubyconf.org.au

This talk will discuss localization and internationalization for Rails applications. We’ll discuss available tools as well as best practices for building apps for localization. We’ll also talk about the more human and subjective struggles of translating ideas and concepts for new audiences.

RubyConf AU 2017

00:00:08.860 Thanks! Hi everybody, today I’m going to be talking about not only the technical ways you can use to localize your Rails applications but also the more human challenges that translation presents. So let's get rolling. First, let’s define our terms: localization is the process of adapting internationalized software for a specific region or language. This is the part where you would hire a translator to translate the strings in your app.
00:00:25.520 Internationalization, on the other hand, refers to what you as a developer should be doing. It's about designing software applications so they can potentially be adapted to various languages and regions without requiring engineering changes. This involves factoring all your strings out into YAML files, making sure that anytime you're using a distance or something that could be regionally variable, you can reference what region a user is coming from and display it to them correctly.
00:01:00.289 When we say translation, the first thing that comes to mind is the typical language-to-language translation, for example, English to French or French to Arabic. However, there are also regional translations to consider, such as dialect differences, measurement variations, and display formats for dates. For instance, you might have to adapt your app from British to American English, from Portuguese to Brazilian Portuguese, or from Canadian to Australian English. The target language may be the same, but there could be variations in how you display data and how your app functions based on those different regions.
00:01:43.310 Another important aspect to consider during the translation process is the register of the language. Consider whether you want your app's language to be formal or informal depending on your intended audience—whether they are children or adults. These are critical considerations for a translator working on your app.
00:02:10.200 Imagine you have a client ready to pay you a fortune for a French version of your app, which so far has only been developed in English with no thought to localization. Honestly, that’s not the best position to be in, particularly because internationalization requires adaptation of the software to start the localization process, which can be a significant amount of work if you haven't considered it from the beginning.
00:02:49.750 So, when should you start thinking about localization? You should consider it as soon as possible in your development process. If your app's potential audience extends beyond Australia or US-based English speakers, or if you are developing in a different original language, localization should definitely be on your radar. Even if you're targeting a US-only audience, remember that many linguistic communities exist within the US. It would make sense to have versions of your app in Spanish and Mandarin, for example.
00:03:35.150 Now, regarding internationalization, this is something you want to start thinking about before you face the need to localize. I recommend taking the initial step of extracting all your strings displayed in your views into a YAML file. This centralization not only makes it easier for developers to manage copies but also prevents them from having to comb through the codebase to change specific words.
00:04:01.099 Rails has several built-in internationalization conventions. I recommend checking out the i18n guide, which uses a key-based YAML system by default. You would call i18n.t and then provide the name of a key, which allows the application to pull the correct translation based on the user’s locale.
00:04:51.030 There are a number of helpful gems you might consider using for your localization work. Rails i18n provides translations for a lot of the standard Rails boilerplate such as Active Record errors and can handle date formats for practically every language imaginable. This can save you the hassle of needing to manage translations for commonly used terms.
00:05:43.240 Another tool is Locale App, which gives translators a web GUI to log in and enter translations, making the whole process more user-friendly. It’s generally unwieldy to have the people providing translations directly editing YAML files, so Locale App provides a solution by allowing you to pull translations from a centralized web interface.
00:06:50.010 Another handy tool is Globalize, which allows you to add translations to Active Record attributes. If, for instance, you have a blog with text that needs translation for each post, Globalize might be exactly what you need. Additionally, GeoCoder can auto-select the user's language and location based on their IP address, which is useful, but you should also provide a way for users to override this if they are traveling or don’t speak the default language.
00:07:13.589 i18n tasks can help you manage your translations effectively by scanning through all your YAML keys and identifying which ones are being used in your app, flagging any unused translations, or highlighting translations that are missing in certain languages.
00:08:05.909 As we’ve discussed, YAML files can become cumbersome in complex applications, potentially involving thousands of strings. If this is the case, consider separating these YAML files by feature or using an application that can export into a YAML file from a database. Additionally, employ version control or some other fallback mechanic to revert to earlier versions in case of accidental deletions or merge conflicts.
00:08:57.330 While managing these YAML files, keep in mind that merging changes can lead to conflicts, especially when many people are trying to edit the same file simultaneously. To alleviate this, either designate a single steward to manage the YAML files or utilize an external source to maintain integrity and reduce the possibility of merge conflicts.
00:09:32.150 When setting up your internationalization system and localization process, consider what exactly needs to be translated in your app. Is it model attributes, large text blocks that may not be conducive to editing in a basic text editor, or individual strings? You also need to determine who will be responsible for translating this text and what tools they may need. It’s important to provide context to translators to ensure the best translations.
00:10:03.090 Let's address some common misunderstandings about translation. One common pitfall is believing that fragments of sentences can be translated accurately without sufficient context. Translation is more complex than just a simple key-value lookup; a translator needs as much contextual information as you can provide.
00:10:59.770 Another misconception is that pluralization works identically across different languages. There are various rules for pluralization, and i18n accommodates this by allowing you to pass a count variable so the appropriate translation can be selected based on the integer passed.
00:11:31.559 Additionally, be aware that different languages often utilize varying levels of specificity in their terms, further emphasizing the need for context during translation. For example, the word 'attachment' may have disparate translations based on its context. A translator will need to know exactly how terms are being used in your application.
00:12:28.930 Keep in mind that a message might not fit into the same physical screen space when translated as it does in English. This is particularly relevant when considering fixed heights or design elements that cannot expand. Language pairs often differ significantly in character count, so ensure that your design accommodates the potential increase.
00:13:59.090 The flow of text will not always be from left to right, as evidenced by websites in French or Arabic. When designing for multilingual contexts, it’s critical to adapt your layout based on the direction of the language. Additionally, the character sets used in different languages might require adjustments in how fonts and styling, such as bolds and italics, are rendered.
00:15:10.120 Beyond technical considerations, think about your app's reception within different cultures and countries, including legal implications related to data privacy. Norms vary significantly from region to region, particularly between places like the US and Europe. Cultural differences can also influence how your app is perceived, as certain symbols may carry different meanings in different cultures.
00:16:52.990 If you remember nothing else from this talk, I urge you to start considering localization as soon as possible. Understand that when you begin localizing something, your translators will need a solid understanding of how your app works, and ideally, they should be able to see it in action. Translation can be a challenging process, and it’s crucial to know your audience. This is particularly true when trying to convey ideas across cultural or geographic boundaries.
00:18:05.640 Thank you for your attention! I'm happy to take any questions. My Twitter handle, Valerie Codes, has been displayed on all the slides, so feel free to reach out. If you have any questions later, my direct messages are always open.
00:19:14.240 We have a couple of minutes for questions, so if anyone has a burning inquiry or something they'd like to discuss, I'm here!
00:19:58.130 Thank you everyone! This has been great!