Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
mdelfede is currently offline  mdelfede
Messages: 1264
Registered: September 2007
Senior 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 #38222 is a reply to message #36802] Fri, 07 December 2012 12:13 Go to previous messageGo to next message
Alboni is currently offline  Alboni
Messages: 203
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
But the same string in English can have different translations in some languages depending on the context where it is used...

eg.

portrait(eng) would be "portret" in Dutch when talking about a painting or a photograph of someone. If we are talking about the way a page should be printed then terms like "Staand" (standing) would be more appropriate.
Re: TheIDE : allow single translation file in main package [message #38223 is a reply to message #38222] Fri, 07 December 2012 12:19 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1264
Registered: September 2007
Senior Contributor
Hi, both things are quite unrelated.

The context can be set by \v option (see manual) :

t_("myContext\vMyString");

The patch above just allows to keep a single translation file per application, collecting ALL translations from single packages, if they don't have internal .t files.
Anyays, you still have the choice of a translation file per package as before; if you provide it, the behaviour is to collect strings from the package in its corresponding .t file.
If you don't have a .t inside package, but you have a .t file in main package, then the patch allows to collect ALL translations of ALL packages belonging to the application in main package's .t file.

Hope it's clear enough....

Max
Re: TheIDE : allow single translation file in main package [message #38224 is a reply to message #38222] Fri, 07 December 2012 12:19 Go to previous message
Zbych is currently offline  Zbych
Messages: 315
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

Previous Topic: true dynamic dispatching with Upp?
Next Topic: Fixing translations
Goto Forum:
  


Current Time: Sun Jan 24 09:58:07 CET 2021

Total time taken to generate the page: 0.01267 seconds