SlideShare uma empresa Scribd logo
1 de 14
Crossing the borders:
         the i18n system




Luca Ottaviano (lottaviano@develer.com)
What is i18n about?

Embracing a specific national environment:
  Language
  Line break behaviour
  Writing direction
  Conventions
...without hampering development
(True) Horror Story




We're in 2002, and a big Italian company wants to
     localize their CAD program in Spanish.

              If only it wasn't for...
(True) Horror Story

Strings were initially hardcoded in Italian,
 English was retrofitted at some point...
...with lots of if/else statements
First try: add another else branch for each
  string in code (...)
Second try: tool to produce multiple
 codebases – one for each language (...)
AFAIK still unfinished two years later
All we need is a good workflow

Developers produce i18n-ready code
  With no codebase pollution
Translators translate strings
  Iteratively (code and strings can change!)
  No technical knowledge needed
The framework does the rest
Developers' step 1

QObject::tr()
Parse-time: marks strings
Run-time: translates strings
Not everything is a QObject...
QCoreApplication::translate()
QT_TR_NOOP



                                 6
Developers' step 2

Use QString for all user visible text
QString are Unicode strings → transparent
processing of strings (reg exp, split etc)
Programmer space strings can still be
QByteArrays or char *




                                             7
Developers' step 3
Use QString::arg() for dynamic text
QString::arg() allows easy argument
reordering


 void FileCopier::showProgress(int done, int total, const
 QString &currentFile)
 {
      label.setText(tr("%1 of %2 files copied.nCopying: %3")
            .arg(done)
            .arg(total)
            .arg(currentFile));
 }


                                                                8
Some glue
Add a TRANSLATIONS entry to .pro
Run lupdate to extract a .ts file
Send .ts file to translators
Run lrelease to produce translated binary
files
Set up a QTranslator
QCoreApplication::installTranslator()



                                            9
Translators' (only) step

Open .ts file with Linguist
Fill the missing translations
There is no step 3


Developer: “...hey that's not fair!”




                                       10
Some case studies

Nearing the 2.0 release:
  Parse again with lupdate
  Fill only the missing translations
Wanting to add a language
  Add that language to TRANSLATIONS
  Run lupdate, translate the new .ts file, lrelease
  This time it's a fairy tale!
Update language on the fly
  installTranslator sends a changeEvent
                                                      11
Workflow demo




                12
THANKS !
                                Develer S.r.l.
                             Via Mugellese 1/A
                         50013 Campi Bisenzio
                                 Firenze - Italy




Contacts
Mail: info@develer.com
Phone: +39-055-3984627
Fax: +39 178 6003614
http://www.develer.com
Gotchas

::tr assumes latin-1
What about Designer files?




                             14

Mais conteúdo relacionado

Mais procurados

Mais procurados (14)

15CS664 Python Question Bank-3
15CS664 Python Question Bank-315CS664 Python Question Bank-3
15CS664 Python Question Bank-3
 
Introduction python
Introduction pythonIntroduction python
Introduction python
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
C compilation process
C compilation processC compilation process
C compilation process
 
Go language presentation
Go language presentationGo language presentation
Go language presentation
 
15CS664- Python Application Programming- Question bank 1
15CS664- Python Application Programming- Question bank 115CS664- Python Application Programming- Question bank 1
15CS664- Python Application Programming- Question bank 1
 
C Lecture
C LectureC Lecture
C Lecture
 
GNU Compiler Collection - August 2005
GNU Compiler Collection - August 2005GNU Compiler Collection - August 2005
GNU Compiler Collection - August 2005
 
How to Work with Dev-C++
How to Work with Dev-C++How to Work with Dev-C++
How to Work with Dev-C++
 
Golang 101
Golang 101Golang 101
Golang 101
 
Dev c++using
Dev c++usingDev c++using
Dev c++using
 
C under Linux
C under LinuxC under Linux
C under Linux
 
How c/c++ works
How c/c++ worksHow c/c++ works
How c/c++ works
 
Python Programming
Python ProgrammingPython Programming
Python Programming
 

Destaque

Qtday Introduzione a qt quick
Qtday  Introduzione a qt quickQtday  Introduzione a qt quick
Qtday Introduzione a qt quickQT-day
 
Qt Creator, l'arma segreta!
Qt Creator, l'arma segreta!Qt Creator, l'arma segreta!
Qt Creator, l'arma segreta!QT-day
 
Qt Networking avanzato
Qt Networking avanzatoQt Networking avanzato
Qt Networking avanzatoQT-day
 
EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...
EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...
EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...QT-day
 
Home automation con BTicino MyHome
Home automation con BTicino MyHomeHome automation con BTicino MyHome
Home automation con BTicino MyHomeQT-day
 
EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...
EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...
EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...QT-day
 
Qt Concurrent
Qt ConcurrentQt Concurrent
Qt ConcurrentQT-day
 
Qt Lezione2: Creare un’applicazione con Qt Creator in pochi semplici passi
Qt Lezione2: Creare un’applicazione con Qt Creator in pochi semplici passiQt Lezione2: Creare un’applicazione con Qt Creator in pochi semplici passi
Qt Lezione2: Creare un’applicazione con Qt Creator in pochi semplici passiPaolo Sereno
 
Sviluppo di App con Qt Quick: un esempio di model-view-delegate
Sviluppo di App con Qt Quick: un esempio di model-view-delegateSviluppo di App con Qt Quick: un esempio di model-view-delegate
Sviluppo di App con Qt Quick: un esempio di model-view-delegatePaolo Sereno
 

Destaque (9)

Qtday Introduzione a qt quick
Qtday  Introduzione a qt quickQtday  Introduzione a qt quick
Qtday Introduzione a qt quick
 
Qt Creator, l'arma segreta!
Qt Creator, l'arma segreta!Qt Creator, l'arma segreta!
Qt Creator, l'arma segreta!
 
Qt Networking avanzato
Qt Networking avanzatoQt Networking avanzato
Qt Networking avanzato
 
EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...
EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...
EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...
 
Home automation con BTicino MyHome
Home automation con BTicino MyHomeHome automation con BTicino MyHome
Home automation con BTicino MyHome
 
EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...
EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...
EBV e Freescale: cosa possono fare per lo sviluppo delle vostre applicazioni ...
 
Qt Concurrent
Qt ConcurrentQt Concurrent
Qt Concurrent
 
Qt Lezione2: Creare un’applicazione con Qt Creator in pochi semplici passi
Qt Lezione2: Creare un’applicazione con Qt Creator in pochi semplici passiQt Lezione2: Creare un’applicazione con Qt Creator in pochi semplici passi
Qt Lezione2: Creare un’applicazione con Qt Creator in pochi semplici passi
 
Sviluppo di App con Qt Quick: un esempio di model-view-delegate
Sviluppo di App con Qt Quick: un esempio di model-view-delegateSviluppo di App con Qt Quick: un esempio di model-view-delegate
Sviluppo di App con Qt Quick: un esempio di model-view-delegate
 

Semelhante a Internazionalizza le tue applicazioni

Crossing the border with Qt: the i18n system
Crossing the border with Qt: the i18n systemCrossing the border with Qt: the i18n system
Crossing the border with Qt: the i18n systemDeveler S.r.l.
 
Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...IndicThreads
 
Building scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftBuilding scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftTalentica Software
 
What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...Sławomir Zborowski
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_netNico Ludwig
 
Experience with C++11 in ArangoDB
Experience with C++11 in ArangoDBExperience with C++11 in ArangoDB
Experience with C++11 in ArangoDBMax Neunhöffer
 
Translating Qt Applications
Translating Qt ApplicationsTranslating Qt Applications
Translating Qt Applicationsaccount inactive
 
Pharo 2.0: An Exciting Milestone
Pharo 2.0: An Exciting MilestonePharo 2.0: An Exciting Milestone
Pharo 2.0: An Exciting MilestoneMarcus Denker
 
Cmp2412 programming principles
Cmp2412 programming principlesCmp2412 programming principles
Cmp2412 programming principlesNIKANOR THOMAS
 
C plus plus for hackers it security
C plus plus for hackers it securityC plus plus for hackers it security
C plus plus for hackers it securityCESAR A. RUIZ C
 
His162013 140529214456-phpapp01
His162013 140529214456-phpapp01His162013 140529214456-phpapp01
His162013 140529214456-phpapp01Getachew Ganfur
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughgabriellekuruvilla
 
C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...Gianluca Padovani
 
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfINTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfSubramanyambharathis
 
Async await in C++
Async await in C++Async await in C++
Async await in C++cppfrug
 
Python Course Basic
Python Course BasicPython Course Basic
Python Course BasicNaiyan Noor
 
Linux and Localization Tutorial Paras pradhan Senior Linux ...
Linux and Localization Tutorial Paras pradhan Senior Linux ...Linux and Localization Tutorial Paras pradhan Senior Linux ...
Linux and Localization Tutorial Paras pradhan Senior Linux ...webhostingguy
 

Semelhante a Internazionalizza le tue applicazioni (20)

Crossing the border with Qt: the i18n system
Crossing the border with Qt: the i18n systemCrossing the border with Qt: the i18n system
Crossing the border with Qt: the i18n system
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
 
Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...
 
Building scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftBuilding scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thrift
 
What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net
 
Experience with C++11 in ArangoDB
Experience with C++11 in ArangoDBExperience with C++11 in ArangoDB
Experience with C++11 in ArangoDB
 
Translating Qt Applications
Translating Qt ApplicationsTranslating Qt Applications
Translating Qt Applications
 
Pharo 2.0: An Exciting Milestone
Pharo 2.0: An Exciting MilestonePharo 2.0: An Exciting Milestone
Pharo 2.0: An Exciting Milestone
 
Cmp2412 programming principles
Cmp2412 programming principlesCmp2412 programming principles
Cmp2412 programming principles
 
C plus plus for hackers it security
C plus plus for hackers it securityC plus plus for hackers it security
C plus plus for hackers it security
 
C++ for hackers
C++ for hackersC++ for hackers
C++ for hackers
 
His162013 140529214456-phpapp01
His162013 140529214456-phpapp01His162013 140529214456-phpapp01
His162013 140529214456-phpapp01
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
 
C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...C++ Actor Model - You’ve Got Mail ...
C++ Actor Model - You’ve Got Mail ...
 
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdfINTRODUCTION TO C PROGRAMMING MATERIAL.pdf
INTRODUCTION TO C PROGRAMMING MATERIAL.pdf
 
Async await in C++
Async await in C++Async await in C++
Async await in C++
 
Programming in C++
Programming in C++Programming in C++
Programming in C++
 
Python Course Basic
Python Course BasicPython Course Basic
Python Course Basic
 
Linux and Localization Tutorial Paras pradhan Senior Linux ...
Linux and Localization Tutorial Paras pradhan Senior Linux ...Linux and Localization Tutorial Paras pradhan Senior Linux ...
Linux and Localization Tutorial Paras pradhan Senior Linux ...
 

Último

Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Último (20)

Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

Internazionalizza le tue applicazioni

  • 1. Crossing the borders: the i18n system Luca Ottaviano (lottaviano@develer.com)
  • 2. What is i18n about? Embracing a specific national environment: Language Line break behaviour Writing direction Conventions ...without hampering development
  • 3. (True) Horror Story We're in 2002, and a big Italian company wants to localize their CAD program in Spanish. If only it wasn't for...
  • 4. (True) Horror Story Strings were initially hardcoded in Italian, English was retrofitted at some point... ...with lots of if/else statements First try: add another else branch for each string in code (...) Second try: tool to produce multiple codebases – one for each language (...) AFAIK still unfinished two years later
  • 5. All we need is a good workflow Developers produce i18n-ready code With no codebase pollution Translators translate strings Iteratively (code and strings can change!) No technical knowledge needed The framework does the rest
  • 6. Developers' step 1 QObject::tr() Parse-time: marks strings Run-time: translates strings Not everything is a QObject... QCoreApplication::translate() QT_TR_NOOP 6
  • 7. Developers' step 2 Use QString for all user visible text QString are Unicode strings → transparent processing of strings (reg exp, split etc) Programmer space strings can still be QByteArrays or char * 7
  • 8. Developers' step 3 Use QString::arg() for dynamic text QString::arg() allows easy argument reordering void FileCopier::showProgress(int done, int total, const QString &currentFile) { label.setText(tr("%1 of %2 files copied.nCopying: %3") .arg(done) .arg(total) .arg(currentFile)); } 8
  • 9. Some glue Add a TRANSLATIONS entry to .pro Run lupdate to extract a .ts file Send .ts file to translators Run lrelease to produce translated binary files Set up a QTranslator QCoreApplication::installTranslator() 9
  • 10. Translators' (only) step Open .ts file with Linguist Fill the missing translations There is no step 3 Developer: “...hey that's not fair!” 10
  • 11. Some case studies Nearing the 2.0 release: Parse again with lupdate Fill only the missing translations Wanting to add a language Add that language to TRANSLATIONS Run lupdate, translate the new .ts file, lrelease This time it's a fairy tale! Update language on the fly installTranslator sends a changeEvent 11
  • 13. THANKS ! Develer S.r.l. Via Mugellese 1/A 50013 Campi Bisenzio Firenze - Italy Contacts Mail: info@develer.com Phone: +39-055-3984627 Fax: +39 178 6003614 http://www.develer.com
  • 14. Gotchas ::tr assumes latin-1 What about Designer files? 14