Qt-interest Archive, May 2007
language translation
Message 1 in thread
hi guys
i m working on qt4.2 on Mac OS X Platform
can anyone tell me how can convert my .app to another languages like
japnese ,spanish,italino etc.
thanks & regards
------------------------
Jyoti Verma
jyoti.verma@xxxxxxxxxxxxxxx
--
[ signature omitted ]
Message 2 in thread
Jyoti Verma schrieb:
> hi guys
> i m working on qt4.2 on Mac OS X Platform
> can anyone tell me how can convert my .app to another languages like
> japnese ,spanish,italino etc.
Just look into your Qt docs; on the first page, under "Core Features",
there's a link to the docs about Internationalization of Qt apps.
Martin
--
[ signature omitted ]
Message 3 in thread
the internationalization in qt i had already read they even are
saying to use Qt liguist..and i had used the same but that is still
not working properly or may be i m doing mistake some where to
understand it
so i need some help
like see i have one combo in which i m showing the all the loaded
languages which having are loaded by translator by .ts and .qm files
languages are loaded properly but now problem is that ,related to
that combo, i have text edit field from where i am getting usergiven
text and as i change the combo language other than english
corresponding text from the textfield does not change.
can anyone tell me how it can be changed
what i have to do with coding that language should be changed
see what ever i am doing;
void langChange :: languageChanged()
{
for (int i = 0; i < qmFiles.size(); i++)
{
comboBox->insertItem(0,languageName(qmFiles[i]),QVariant());
}
}
void langChange :: changed()
{
QString str;
str=textEdit->toPlainText ();
QMessageBox::information(0,"!!",str);
//WHAT TO DO
}
QString langChange::languageName(const QString &qmFile)
{
QTranslator translator;
translator.load(qmFile);
//qApp->installTranslator(&translator);
return translator.translate("MainWindow", "English");
}
QStringList langChange::namesQmFiles()
{
QDir dir("");//corresponding dir path
QString strFileName = "";
QStringList fileNames = dir.entryList(QStringList("*.qm"),
QDir::Files,QDir::Name);
QMutableStringListIterator i(fileNames);
while (i.hasNext())
{
i.next();
i.setValue(dir.filePath(i.value()));
}
return fileNames;
}
thanks & regards
------------------------
Jyoti Verma
jyoti.verma@xxxxxxxxxxxxxxx
Message 4 in thread
On 11.05.07 19:20:35, Jyoti Verma wrote:
> the internationalization in qt i had already read they even are saying to use
> Qt liguist..and i had used the same but that is still not working properly or
> may be i m doing mistake some where to understand it
> so i need some help
>
> like see i have one combo in which i m showing the all the loaded languages
> which having are loaded by translator by .ts and .qm files
>
> languages are loaded properly but now problem is that ,related to that combo,
> i have text edit field from where i am getting usergiven text and as i change
> the combo language other than english corresponding text from the textfield
> does not change.
You're misunderstanding something here. User input cannot be translated
easily, except if you allow only certain strings that you know before
running. But in that case a combobox or radiobuttons is much better.
Building an application that translates any text a user inputs into a
textfield is something different then internationalizing your
application. For that you have to find dictionaries for the languages
you want and then lookup the text in the input field in that dictionary.
This will of course only work on simple words, if your goal is something
that translates word groups or even sentences you've got a whole lot
more todo, like analyzing the words findout out what type of word you
have (noun, verb,...) and the grammar of a sentence. There's nothing in
Qt that directly helps you with that task, i.e. no dictionary, no
word-analyzers and so on.
Andreas
--
[ signature omitted ]
Message 5 in thread
Are you trying to make it, so when the user changes language from a
combobox, all the languages are displayed in the new languages native
wording? So that say, "English" was shown in English if English was
selected, but was shown as ingles in spanash, or as anglais if French is
selected?
f so, here is how I would do it.
First, determine the list of translateable languages
Second, add each language name to the combo box as a tr( "English" )
type
Third, make sure each translataion has the name of every other language
Finally, Make sure your hooked up to the global language changed signal
(forgot the name of it off the top of my head)
That should take care of it.
Scott
________________________________
From: Jyoti Verma [mailto:jyoti.verma@xxxxxxxxxxxxxxx]
Sent: Friday, May 11, 2007 6:51 AM
To: Qt Interest List
Subject: language translation
the internationalization in qt i had already read they even are saying
to use Qt liguist..and i had used the same but that is still not working
properly or may be i m doing mistake some where to understand it
so i need some help
like see i have one combo in which i m showing the all the loaded
languages which having are loaded by translator by .ts and .qm files
languages are loaded properly but now problem is that ,related to that
combo, i have text edit field from where i am getting usergiven text and
as i change the combo language other than english corresponding text
from the textfield does not change.
can anyone tell me how it can be changed
what i have to do with coding that language should be changed
see what ever i am doing;
void langChange :: languageChanged()
{
for (int i = 0; i < qmFiles.size(); i++)
{
comboBox->insertItem(0,languageName(qmFiles[i]),QVariant());
}
}
void langChange :: changed()
{
QString str;
str=textEdit->toPlainText ();
QMessageBox::information(0,"!!",str);
//WHAT TO DO
}
QString langChange::languageName(const QString &qmFile)
{
QTranslator translator;
translator.load(qmFile);
//qApp->installTranslator(&translator);
return translator.translate("MainWindow", "English");
}
QStringList langChange::namesQmFiles()
{
QDir dir("");//corresponding dir path
QString strFileName = "";
QStringList fileNames = dir.entryList(QStringList("*.qm"),
QDir::Files,QDir::Name);
QMutableStringListIterator i(fileNames);
while (i.hasNext())
{
i.next();
i.setValue(dir.filePath(i.value()));
}
return fileNames;
}
thanks & regards
------------------------
Jyoti Verma
jyoti.verma@xxxxxxxxxxxxxxx
Message 6 in thread
can u please tell me how can i change the text of line edit or text
edit in after selecting a new language in my code which r included in
my application folder
u see my .pro file and .qrc file
.qrc file is:
<RCC version="1.0">
<qresource>
<file>translations/langChange_ar.qm</file>
<file>translations/langChange_cs.qm</file>
<file>translations/langChange_de.qm</file>
<file>translations/langChange_el.qm</file>
<file>translations/langChange_en.qm</file>
<file>translations/langChange_eo.qm</file>
</qresource>
</RCC>
.pro file is
TEMPLATE = app
TARGET =
DEPENDPATH += . translations
INCLUDEPATH += .
# Input
HEADERS += langChange.h
FORMS += langChange.ui
SOURCES += langChange.cpp main.cpp
RESOURCES += langchange.qrc
TRANSLATIONS += translations/langChange_ar.ts \
translations/langChange_cs.ts \
translations/langChange_de.ts \
translations/langChange_el.ts \
translations/langChange_en.ts \
translations/langChange_eo.ts
now can u please do tell me where is the problem going on
code is:
void langChange :: languageChanged()
{
for (int i = 0; i < qmFiles.size(); i++)
{
comboBox->insertItem(0,languageName(qmFiles[i]),QVariant());
}
}
void langChange :: changed(QString str)
{
str=textEdit->toPlainText ();
QMessageBox::information(0,"!!",languageName(str));
//WHAT TO DO
}
QString langChange::languageName(const QString &qmFile)
{
QTranslator translator;
translator.load(qmFile);
//qApp->installTranslator(&translator);
return translator.translate("MainWindow", "English");
}
QStringList langChange::namesQmFiles()
{
QDir dir("");//corresponding dir path
QString strFileName = "";
QStringList fileNames = dir.entryList(QStringList("*.qm"),
QDir::Files,QDir::Name);
QMutableStringListIterator i(fileNames);
while (i.hasNext())
{
i.next();
i.setValue(dir.filePath(i.value()));
}
return fileNames;
}
now what more i have to do...
thanks in advance
On 11-May-07, at 8:29 PM, Scott Aron Bloom wrote:
> Are you trying to make it, so when the user changes language from a
> combobox, all the languages are displayed in the new languages
> native wording? So that say, “English” was shown in English if
> English was selected, but was shown as ingles in spanash, or as
> anglais if French is selected?
>
>
>
> f so, here is how I would do it.
>
>
>
> First, determine the list of translateable languages
>
> Second, add each language name to the combo box as a tr
> ( “English” ) type
>
> Third, make sure each translataion has the name of every other
> language
>
> Finally, Make sure your hooked up to the global language changed
> signal (forgot the name of it off the top of my head)
>
>
>
> That should take care of it.
>
>
>
> Scott
>
> From: Jyoti Verma [mailto:jyoti.verma@xxxxxxxxxxxxxxx]
> Sent: Friday, May 11, 2007 6:51 AM
> To: Qt Interest List
> Subject: language translation
>
>
>
> the internationalization in qt i had already read they even are
> saying to use Qt liguist..and i had used the same but that is still
> not working properly or may be i m doing mistake some where to
> understand it
>
> so i need some help
>
>
>
> like see i have one combo in which i m showing the all the loaded
> languages which having are loaded by translator by .ts and .qm files
>
>
>
> languages are loaded properly but now problem is that ,related to
> that combo, i have text edit field from where i am getting
> usergiven text and as i change the combo language other than
> english corresponding text from the textfield does not change.
>
>
>
> can anyone tell me how it can be changed
>
>
>
> what i have to do with coding that language should be changed
>
>
>
> see what ever i am doing;
>
>
>
> void langChange :: languageChanged()
>
> {
>
> for (int i = 0; i < qmFiles.size(); i++)
>
> {
>
> comboBox->insertItem(0,languageName(qmFiles[i]),QVariant());
>
>
> }
>
> }
>
>
>
> void langChange :: changed()
>
> {
>
> QString str;
>
> str=textEdit->toPlainText ();
>
> QMessageBox::information(0,"!!",str);
>
> //WHAT TO DO
>
> }
>
>
>
> QString langChange::languageName(const QString &qmFile)
>
> {
>
> QTranslator translator;
>
> translator.load(qmFile);
>
> //qApp->installTranslator(&translator);
>
> return translator.translate("MainWindow", "English");
>
> }
>
>
>
>
>
> QStringList langChange::namesQmFiles()
>
> {
>
> QDir dir("");//corresponding dir path
>
> QString strFileName = "";
>
> QStringList fileNames = dir.entryList(QStringList
> ("*.qm"), QDir::Files,QDir::Name);
>
> QMutableStringListIterator i(fileNames);
>
> while (i.hasNext())
>
> {
>
> i.next();
>
> i.setValue(dir.filePath(i.value()));
>
> }
>
>
> return fileNames;
>
> }
>
>
>
> thanks & regards
>
> ------------------------
>
> Jyoti Verma
>
> jyoti.verma@xxxxxxxxxxxxxxx
>
>
>
>
>
>
>
>
>
thanks & regards
------------------------
Jyoti Verma
jyoti.verma@xxxxxxxxxxxxxxx
Message 7 in thread
Hi,
> can u please tell me how can i change the text of line edit or text edit
> in after selecting a new language in my code which r included in my
> application folder
I'm not certain I understand you correctly, but if you need to cha,ge teh
language of a GUI dynamically, have a look at this:
http://doc.trolltech.com/qq/qq08-swedish-chef-sequel.html#dynamic
--
[ signature omitted ]