SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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

En vedette

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
 

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

Similaire à 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
 

Similaire à 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 ...
 

Dernier

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 

Dernier (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 

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