Qt-interest Archive, May 2007
Internationalization question
Pages: Prev | 1 | 2 | Next
Message 16 in thread
Till Oliver Knoll wrote:
> Susan Macchia schrieb:
>> Till Oliver Knoll wrote:
>>>> ...
>>>> our C++ files are postfixed with .C not .cpp.... I'll experiment a
>>>> ...
> I had actually the following in mind: there was this other guy a few
> weeks ago on this list, bashing the hell out of Windows, because he
> had those two files named:
>
> foo.c
> foo.C
>
> Works perfectly on any case-sensitive file system. But guess what
> happened to him on Windows (hint: FAT32/NTFS are merely
> case-preserving ;)... >:-)
Ouch! That would sting, no matter what the compiler on that platform.
Gotta love it.
---
This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.
Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den Absender zurück und löschen Sie die E-mail aus Ihrem System.
--
[ signature omitted ]
Message 17 in thread
> Works perfectly on any case-sensitive file system. But guess what
> happened to him on Windows (hint: FAT32/NTFS are merely
case-preserving
> ;)... >:-)
>
> Cheers, Oliver
>
> --
What would the 2 targets be? foo.o and foo.O ?
Scott
--
[ signature omitted ]
Message 18 in thread
Scott Aron Bloom schrieb:
>> Works perfectly on any case-sensitive file system. But guess what
>> happened to him on Windows (hint: FAT32/NTFS are merely
> case-preserving
>> ;)... >:-)
>>
>> Cheers, Oliver
>>
>> --
> What would the 2 targets be? foo.o and foo.O ?
This question is rather academic I guess - have you ever tried creating
two files (in the same directory) on Windows named foo.c and foo.C? ;)
Cheers, Oliver
p.s. The real question back then was actually foo.cpp vs. FOO.cpp; the
argument was that FOO.cpp would merely contain global data/macros or the
like for the actual class defined in foo.cpp... or so I remember.
--
[ signature omitted ]
Message 19 in thread
Till Oliver Knoll schrieb:
> Scott Aron Bloom schrieb:
>>> Works perfectly on any case-sensitive file system. But guess what
Well you're right: it doesn't work.
>>>
>> What would the 2 targets be? foo.o and foo.O ?
> ...
> p.s. The real question back then was actually foo.cpp vs. FOO.cpp
Well, the *really real* question back then was foo.h vs. FOO.h - now I
got it right :)
Cheers, Oliver
--
[ signature omitted ]
Message 20 in thread
> Scott Aron Bloom schrieb:
> >> Works perfectly on any case-sensitive file system. But guess what
> >> happened to him on Windows (hint: FAT32/NTFS are merely
> > case-preserving
> >> ;)... >:-)
> >>
> >> Cheers, Oliver
> >>
> >> --
> > What would the 2 targets be? foo.o and foo.O ?
>
> This question is rather academic I guess - have you ever tried
creating
> two files (in the same directory) on Windows named foo.c and foo.C? ;)
>
> Cheers, Oliver
>
> p.s. The real question back then was actually foo.cpp vs. FOO.cpp; the
> argument was that FOO.cpp would merely contain global data/macros or
the
> like for the actual class defined in foo.cpp... or so I remember.
>
I remember the first time I ported an app (non-qt... long long time ago)
from SunOS and HP-UX to windows NT (we gave up on building win95 because
of case and other file naming issues)
We wound up moving all .C files to .cpp for our "makefile generation
tools" (read custom qmake) to work on MKS shell (cygwin wasn't stable
enough).
O well... fond fond memories :)
Scott
--
[ signature omitted ]
Message 21 in thread
Scott Aron Bloom wrote:
> I remember the first time I ported an app (non-qt... long long time ago)
> from SunOS and HP-UX to windows NT (we gave up on building win95 because
> of case and other file naming issues)
>
> We wound up moving all .C files to .cpp for our "makefile generation
> tools" (read custom qmake) to work on MKS shell (cygwin wasn't stable
> enough).
>
>
> O well... fond fond memories :)
Now you're dating yourself :)
I remember having to write a prototype for a gui toolkit that would run
on SunOS (ahem, not Solaris yet) and Windows NT. MFC wasn't even
available yet. Lots of fun debugging under CodeView. This is when we
thought WinNT would take over the server market... =-O
---
This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.
Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den Absender zurück und löschen Sie die E-mail aus Ihrem System.
--
[ signature omitted ]
Message 22 in thread
Till Oliver Knoll wrote:
> Scott Aron Bloom schrieb:
>>> Works perfectly on any case-sensitive file system. But guess what
>>> happened to him on Windows (hint: FAT32/NTFS are merely
>> case-preserving
>>> ;)... >:-)
>>>
>>> Cheers, Oliver
>>>
>>> --
>> What would the 2 targets be? foo.o and foo.O ?
>
> This question is rather academic I guess - have you ever tried
> creating two files (in the same directory) on Windows named foo.c and
> foo.C? ;)
Not if I could help it ;)
But fun to contemplate nonetheless.
>
> Cheers, Oliver
>
> p.s. The real question back then was actually foo.cpp vs. FOO.cpp; the
> argument was that FOO.cpp would merely contain global data/macros or
> the like for the actual class defined in foo.cpp... or so I remember.
Same problem, different letters :)
---
This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.
Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den Absender zurück und löschen Sie die E-mail aus Ihrem System.
--
[ signature omitted ]
Message 23 in thread
Scott Aron Bloom wrote:
>> Works perfectly on any case-sensitive file system. But guess what
>> happened to him on Windows (hint: FAT32/NTFS are merely
>>
> case-preserving
>
>> ;)... >:-)
>>
>> Cheers, Oliver
>>
>> --
>>
> What would the 2 targets be? foo.o and foo.O ?
>
<chuckle> I suppose you could pass -o to the compiler for this...ick.
Just to be rid of the whole dang problem, I would rename foo.c to
fooTheCversion.c and be done with it. FWIW ;)
---
This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.
Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den Absender zurück und löschen Sie die E-mail aus Ihrem System.
Message 24 in thread
We have one project file. The file that is created from the qmake command below. Let me explain. This project has a very complicated build system that was created long before we ported the application(s) to QT. So instead of changing all of our makefiles over, we just added the QT includes and libs to the current system. Then we built this way of doing translations. So our hierarchy goes about 3 levels deep (at the most).
-----Original Message-----
From: Susan Macchia [mailto:qt-list@xxxxxxxxxxxxx]
Sent: Monday, May 21, 2007 11:38
To: qt-interest@xxxxxxxxxxxxx
Subject: Re: Internationalization question
One more question - do you have only one project file? We have many at the different levels within the hierarchy, this could be why it works at the top for you and not me.
Susan Macchia wrote:
Thanks - this is good stuff.
So, you have a top level project file which contains the TRANSLATIONS line where all the .ts files are defined and lupdate goes through recursively finding the SOURCES & HEADERS?
I tried that and it didn't work, but perhaps that's because all our C++ files are postfixed with .C not .cpp.... I'll experiment a bit more.
Jones, Torrin A (US SSA) wrote:
Well running the commands below does the trick for us. I'm no expert in this, but as far as I can tell the qmake command creates a new project with all the source files (obtained recursively) in it. And the lupdate creates the translation file from the project file. These 2 commands are in a script for us. The script has comments warning about the fact that this can take more than 2 hours. So if you haven't already, you might want to run it on a smaller directory first.
By the way, what Till Oliver Knoll said about having to 2 .qm/.ts files is correct. You'll need to load the one for QT and the one you create. We only do this at start up, but I guess the new hotness is the do it whenever you get a LanguageChange event.
Good luck.
-----Original Message-----
From: Susan Macchia [mailto:qt-list@xxxxxxxxxxxxx]
Sent: Monday, May 21, 2007 10:36
To: Jones, Torrin A (US SSA)
Cc: qt-interest@xxxxxxxxxxxxx
Subject: Re: Internationalization question
That's the goal for us - 1 translation file. But the issue is that source hierarchy is deep and lupdate doesn't find all sources to translate when executed from the top.
Jones, Torrin A (US SSA) wrote:
I'm not sure about your first question because we only create 1 ts file. Other people worry about creating the translation from that .ts file. I don't know if this will help, but this is how we do it.
qmake -project -o project.pro development_directory
lupdate project.pro
As for installing the translation, we only install the one that is appropriate for the current language.
QTranslator project_translator(0);
project+translator.load(QString("project_") + QTextCodec::locale(), "translation_directory");
installTranslator(&project_translator);
Sorry if there are typos. I typed this from memory.
-----Original Message-----
From: Susan Macchia [mailto:qt-list@xxxxxxxxxxxxx]
Sent: Monday, May 21, 2007 09:32
To: qt-interest@xxxxxxxxxxxxx
Subject: Internationalization question
Hi,
We are about to decide how we will be doing internationalization using the Qt Tools. Our source tree is complex and has many levels. From the documentation and what I have been able to try, lupdate doesn't appear capable of traversing the entire tree to create one .ts file for each language (unless I do: lupdate `find . -name \*.\[Ch\]` -ts ./i18n/central_{it,fr,...}.ts).
Is this correct? Is there another technique that big projects use that is better?
Also, if I have multiple translation files (.qm), does that mean that I have to instantiate a separate QTranslator object for each and install each translator on the application (using QApplication::installTranslater) ?
Thanks in advance,
Susan
---
This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.
Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den Absender zurück und löschen Sie die E-mail aus Ihrem System.
Message 25 in thread
Ah - ok, we have a mixed bag here, some legacy, but lots of new stuff in
nested directories with .pro files at each level where an app or a
shared lib is created. That's why I think we'll have to go with the
technique Tim Oliver Knoll uses.
Thanks again for all the info.
--Susan
Jones, Torrin A (US SSA) wrote:
> We have one project file. The file that is created from the qmake
> command below. Let me explain. This project has a very complicated
> build system that was created long before we ported the application(s)
> to QT. So instead of changing all of our makefiles over, we just
> added the QT includes and libs to the current system. Then we built
> this way of doing translations. So our hierarchy goes about 3 levels
> deep (at the most).
>
>
> -----Original Message-----
> *From:* Susan Macchia [mailto:qt-list@xxxxxxxxxxxxx]
> *Sent:* Monday, May 21, 2007 11:38
> *To:* qt-interest@xxxxxxxxxxxxx
> *Subject:* Re: Internationalization question
>
> One more question - do you have only one project file? We have
> many at the different levels within the hierarchy, this could be
> why it works at the top for you and not me.
>
> Susan Macchia wrote:
>> Thanks - this is good stuff.
>>
>> So, you have a top level project file which contains the
>> TRANSLATIONS line where all the .ts files are defined and lupdate
>> goes through recursively finding the SOURCES & HEADERS?
>>
>> I tried that and it didn't work, but perhaps that's because all
>> our C++ files are postfixed with .C not .cpp.... I'll experiment
>> a bit more.
>>
>> Jones, Torrin A (US SSA) wrote:
>>> Well running the commands below does the trick for us. I'm no
>>> expert in this, but as far as I can tell the qmake command
>>> creates a new project with all the source files (obtained
>>> recursively) in it. And the lupdate creates the translation
>>> file from the project file. These 2 commands are in a script
>>> for us. The script has comments warning about the fact that
>>> this can take more than 2 hours. So if you haven't already, you
>>> might want to run it on a smaller directory first.
>>>
>>> By the way, what Till Oliver Knoll said about having to 2
>>> .qm/.ts files is correct. You'll need to load the one for QT
>>> and the one you create. We only do this at start up, but I
>>> guess the new hotness is the do it whenever you get a
>>> LanguageChange event.
>>>
>>> Good luck.
>>>
>>> -----Original Message-----
>>> *From:* Susan Macchia [mailto:qt-list@xxxxxxxxxxxxx]
>>> *Sent:* Monday, May 21, 2007 10:36
>>> *To:* Jones, Torrin A (US SSA)
>>> *Cc:* qt-interest@xxxxxxxxxxxxx
>>> *Subject:* Re: Internationalization question
>>>
>>> That's the goal for us - 1 translation file. But the issue
>>> is that source hierarchy is deep and lupdate doesn't find
>>> all sources to translate when executed from the top.
>>>
>>> Jones, Torrin A (US SSA) wrote:
>>>> I'm not sure about your first question because we only
>>>> create 1 ts file. Other people worry about creating the
>>>> translation from that .ts file. I don't know if this will
>>>> help, but this is how we do it.
>>>>
>>>> qmake -project -o project.pro development_directory
>>>>
>>>> lupdate project.pro
>>>>
>>>> As for installing the translation, we only install the one
>>>> that is appropriate for the current language.
>>>>
>>>> QTranslator project_translator(0);
>>>> project+translator.load(QString("project_") +
>>>> QTextCodec::locale(), "translation_directory");
>>>> installTranslator(&project_translator);
>>>>
>>>> Sorry if there are typos. I typed this from memory.
>>>>
>>>>
>>>> -----Original Message-----
>>>> *From:* Susan Macchia [mailto:qt-list@xxxxxxxxxxxxx]
>>>> *Sent:* Monday, May 21, 2007 09:32
>>>> *To:* qt-interest@xxxxxxxxxxxxx
>>>> *Subject:* Internationalization question
>>>>
>>>> Hi,
>>>>
>>>> We are about to decide how we will be doing
>>>> internationalization using the Qt Tools. Our source
>>>> tree is complex and has many levels. From the
>>>> documentation and what I have been able to try, lupdate
>>>> doesn't appear capable of traversing the entire tree to
>>>> create one .ts file for each language (unless I do:
>>>> /*lupdate `find . -name \*.\[Ch\]` -ts
>>>> ./i18n/central_{it,fr,...}.ts).*/
>>>>
>>>> Is this correct? Is there another technique that big
>>>> projects use that is better?
>>>>
>>>> Also, if I have multiple translation files (.qm), does
>>>> that mean that I have to instantiate a separate
>>>> QTranslator object for each and install each translator
>>>> on the application (using
>>>> QApplication::installTranslater) ?
>>>>
>>>> Thanks in advance,
>>>> Susan
>>>>
> ---
> This communication contains confidential information. If you are
> not the intended recipient please return this email to the sender
> and delete it from your records.
>
> Diese Nachricht enthält vertrauliche Informationen. Sollten Sie
> nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie
> bitte diese an den Absender zurück und löschen Sie die E-mail aus
> Ihrem System.
>
---
This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.
Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den Absender zurück und löschen Sie die E-mail aus Ihrem System.
Message 26 in thread
Susan Macchia schrieb:
> Ah - ok, we have a mixed bag here, some legacy, but lots of new stuff
> in nested directories with .pro files at each level where an app or a
> shared lib is created. That's why I think we'll have to go with the
> technique Tim Oliver Knoll uses.
Well, thinking about the other presented solution (script-based
"makefile generation") the following could work:
Do in a script 'i18n.sh':
- cd to the project root directory
- run qmake like this:
qmake -project -o i18n.pro
The trick is that qmake *does* search the folders recursively. This will
create a project file 'i18n.pro', containing all SOURCES, INCLUDES and
FORMS to be translated (depending on the project size it takes some
minutes). Oh! And in fact I just realised that it also adds the proper
TRANSLATIONS line into this file as well *if* it finds a subdirectory
containing *.ts files - nice :)
That works with Qt 3, but should work accordingly with Qt 4.
So in fact all that is left to do (in the above i18n.sh script) is a:
- lupdate i18n.pro
And you're done :)
Cheers, Oliver
--
[ signature omitted ]
Message 27 in thread
Thanks Oliver. We've got the other approach working and it was very
easy. We have our translation file in a directory off the top, so it
works out for the best.
for example:
src
i18n
i18n.pro (includes all the *_src.pro)
subdir1
subdir1.pro (includes subdir1_src.pro)
subdir1_src.pro
subdir2
subdir2.pro (includes subdir2_src.pro)
subdir2_src.pro
.
.
.
etc.
Then all we need to do is run lupdate on src/i18n/i18n.pro
Thanks again for the info.
-- Susan
Till Oliver Knoll wrote:
> Susan Macchia schrieb:
>> Ah - ok, we have a mixed bag here, some legacy, but lots of new
>> stuff in nested directories with .pro files at each level where an
>> app or a shared lib is created. That's why I think we'll have to go
>> with the technique Tim Oliver Knoll uses.
>
> Well, thinking about the other presented solution (script-based
> "makefile generation") the following could work:
>
> Do in a script 'i18n.sh':
>
> - cd to the project root directory
> - run qmake like this:
> qmake -project -o i18n.pro
>
> The trick is that qmake *does* search the folders recursively. This
> will create a project file 'i18n.pro', containing all SOURCES,
> INCLUDES and FORMS to be translated (depending on the project size it
> takes some minutes). Oh! And in fact I just realised that it also adds
> the proper TRANSLATIONS line into this file as well *if* it finds a
> subdirectory containing *.ts files - nice :)
>
> That works with Qt 3, but should work accordingly with Qt 4.
>
> So in fact all that is left to do (in the above i18n.sh script) is a:
>
> - lupdate i18n.pro
>
> And you're done :)
>
> Cheers, Oliver
---
This communication contains confidential information. If you are not the intended recipient please return this email to the sender and delete it from your records.
Diese Nachricht enthält vertrauliche Informationen. Sollten Sie nicht der beabsichtigte Empfänger dieser E-mail sein, senden Sie bitte diese an den Absender zurück und löschen Sie die E-mail aus Ihrem System.
--
[ signature omitted ]