Top Banner
Translating Drupal Websites Sean Burlington www.PracticalWeb.co.uk Quick run through Translation generally Lessons learned Drupal specifics String translation Page translation
22

Translating Drupal Websites Sean Burlington Quick run through Translation generally Lessons learned Drupal specifics String.

Jan 16, 2016

Download

Documents

Ronald Reeves
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

Translating Drupal Websites

Sean Burlington www.PracticalWeb.co.uk Quick run through

Translation generally Lessons learned Drupal specifics String translation Page translation

Page 2: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

A long Time ago ...

Page 3: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

Nictotinell.com

Project developed in custom PHP Design first Then functionality Lastly translation

Page 4: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

What I learned then

Norwegian words are really long.. Text gifs, layout tables, and translations !@#!* Don't take shortcuts Good Practice pays off Balance the tags in every template Don't let translation be an afterthought

Page 5: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

Still before Drupal

Page 6: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

How it worked

Custom “CMS” 2 languages English/Welsh script.aculo.us In place editing Suprising how may 'odd' pages crop up

Page 7: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

www.useyourpaths.info

Page 8: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.
Page 9: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

Complex Pages

Long forms Lots of little bits of text The in-place editing really helped for long forms No support calls :-)

Page 10: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.
Page 11: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

Drupal

(version 5)

Page 12: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

Manage Strings

Page 13: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

Locale Module (core)

Enhances the t function Make sure everyone reads

http://api.drupal.org/api/function/t/5 Choose a standard

Does it include trailing spaces? What about punctuation? Avoid t($text) – use t('literal text')

Page 14: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

format_plural()

1 item – 2 items

format_plural($feed->items, '1 item', '@count items')

Calls t() internally

Page 15: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

Problems with Manage Strings Strings originally in code – but translated from

database

String only available for translation after it has been displayed

Hard to find strings What about error messages How do you know when you're finished How to test a translation

Page 16: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

Solution

Potx – extracts strings from t functionsAllows you to select by module

http://translate.sourceforge.net/wiki/toolkit/csv2po

But this gives admin and public text together We wrote an upload languages module

(I'm trying to GPL this) This takes a CSV of all languages – and returns

a merged CSV including any new translations Useful for deployment

Page 17: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

Localizer Module

Page 18: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

Lots of options

Page 19: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

Localizernode

Works with custom node types Just implement the usual hooks

(_insert, _update, _delete) Creates a “Translation set” of nodes from the

original node

Page 20: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

Translations tab

Page 21: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

What it does Creates new nodes that are translations of

existing ones Maintains a lookup table Automatically displays the users preferred

translation It works nicely But – we had nodes that referred to other nodes

on another site via a CCK field and SOAP ... Make sure everyone knows about the lookup

table at an early stage !

Page 22: Translating Drupal Websites Sean Burlington  Quick run through  Translation generally  Lessons learned  Drupal specifics  String.

In General

Plan Check your design Introduce standards early Test dummy translations early Translate late