Home » Developing U++ » U++ Developers corner » TheIDE : allow single translation file in main package
TheIDE : allow single translation file in main package [message #36802] |
Fri, 06 July 2012 19:32 |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
Working with a big project composed of many packages, I had the problem of maintaining all translation files spread in each package; so, I made a small mod to theide that allows to have a single .t file in main package.
So, now you can do it in 3 ways :
1) Modular one, as before, a single translation file per package
2) Main package centric : if no .t files are found inside an used package, but there's one in main package, the translations are synced in the main package .t file.
3) Mixed : if an used package has a .t file, it's still used.
Resulting main package .t file example :
#ifdef _MSC_VER
#pragma setlocale("C")
#endif
// main.cpp
T_("main package string\n")
itIT("stringa nel programma principale\n")
// PACKAGE 'TestLangSlave1' FILE 'test1.cpp'
T_("first slave package test string\n")
itIT("stringa test nel primo package slave\n")
T_("same text string in both packages\n")
itIT("stessa stringa in entrambi i package\n")
// PACKAGE 'TestLangSlave2' FILE 'test1.cpp'
T_("second slave package test string\n")
itIT("stringa test nel secondo package slave\n")
As you see, the string
T_("same text string in both packages\n")
is output just once, which is the true advantage of this way of translating when you've many identical strings in different packages : just one translation to maintain, and you can be sure to have same text.
here, a third package with its own translation file, still gets its language strings there :
ifdef _MSC_VER
#pragma setlocale("C")
#endif
// pippo.cpp
T_("this is in third package, with own translation file\n")
itIT("questo è il terzo package, col suo file di traduzione\n")
T_("same text string in both packages\n")
itIT("stessa stringa in entrambi i package\n")
Ciao
Max
|
|
|
|
|
Re: TheIDE : allow single translation file in main package [message #38224 is a reply to message #38222] |
Fri, 07 December 2012 12:19 |
Zbych
Messages: 327 Registered: July 2009
|
Senior Member |
|
|
You can use context translation:
Quote: |
- context keys consist of context and en-US text separated by \v, where both are parts of key. Example: t_("align\vTop"). This is useful in cases when context is needed to provide translation.
- id keys consist of id and en-US text separated by \a, but only id is used as key in translation lookup. Example: t_("CtrlCoreReport\aReport").
|
[Updated on: Fri, 07 December 2012 12:20] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat Sep 21 00:09:46 CEST 2024
Total time taken to generate the page: 0.03015 seconds
|