[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-edu-devel
Subject:    Re: [kde-edu]: Re: [SPAM] [Bug 85106] New: Can not translate Download
From:       Josef Spillner <spillner () kde ! org>
Date:       2004-07-15 18:36:29
Message-ID: 200407151536.29821.spillner () kde ! org
[Download RAW message or body]

Em Ter 13 Jul 2004 15:30, Anne-Marie Mahfouf escreveu:
> I have a password and login but then I don't know what to do. When i login
> there is a 'Pending Translations' page but nothing but test in it. I don't
> know how to get the data shown here. When the data is in, I can give
> translators access and they use the web interface to translate. The only
> thing is about how do I get the data to be read?

The i18n of knewstuff had some bugs, due to the current freeze I've appended a 
proposed patch. It changes the search a bit:
- first, try to lookup the data in the user's desktop language
- if not present, try the entry without language attribute, which is the 
default entry (if it exists)
- if still not present, use any language

I know this is still not the best way of doing things. It should probably use 
the whole list of languages the user has configured.

Only the summary, payload and preview have support for i18n. The data 
title/name itself cannot (yet) be translated. I'm not sure this can be added 
in a way it doesn't break BC. But I can see the need for this entry to also 
have translation.

About the web interface: A user (translator role) has to specify all the 
languages that he/she speaks. Afterwards, all entries which are missing 
entries translated to those languages can be edited.
Note that since Quanta+ also started to use knewstuff, they're working on a 
much improved infrastructure. Aside from OpenPGP support (which I hope all 
knewstuff apps will get in KDE 4), Quanta is used a lot by web developers, so 
a more usable web interface is not just a pipe dream anymore...

Josef

["knewstuff.languages.diff" (text/x-diff)]

Index: downloaddialog.cpp
===================================================================
RCS file: /home/kde/kdelibs/knewstuff/downloaddialog.cpp,v
retrieving revision 1.12
diff -u -r1.12 downloaddialog.cpp
--- downloaddialog.cpp	8 Apr 2004 15:38:09 -0000	1.12
+++ downloaddialog.cpp	15 Jul 2004 18:12:29 -0000
@@ -329,6 +329,8 @@
   Entry *e = getEntry();
   if(!e) return;
 
+  QString lang = KGlobal::locale()->language();
+
   QString info = i18n
   (
     "Name: %1\n"
@@ -348,7 +350,7 @@
     ).arg(e->rating()
     ).arg(e->downloads()
     ).arg(e->releaseDate().toString()
-    ).arg(e->summary()
+    ).arg(e->summary(lang)
   );
 
   info.append(i18n
@@ -445,21 +447,22 @@
   QString tmp;
   bool enabled;
   Entry *e = getEntry();
+  QString lang = KGlobal::locale()->language();
 
   if(e)
   {
-    if(!e->preview().isValid())
+    if(!e->preview(lang).isValid())
     {
       m_rt->setText(QString("<b>%1</b><br>%2<br>%3<br><br><i>%4</i><br>(%5)").arg(
-        e->name()).arg(e->author()).arg(e->releaseDate().toString()).arg(e->summary()).arg(e->license()));
 +        e->name()).arg(e->author()).arg(e->releaseDate().toString()).arg(e->summary(lang)).arg(e->license()));
  }
     else
     {
-      KIO::NetAccess::download(e->preview(), tmp, this);
+      KIO::NetAccess::download(e->preview(lang), tmp, this);
       m_rt->setText(QString("<b>%1</b><br>%2<br>%3<br><br><img \
                src='%4'><br><i>%5</i><br>(%6)").arg(
-        e->name()).arg(e->author()).arg(e->releaseDate().toString()).arg(tmp).arg(e->summary()).arg(e->license()));
 +        e->name()).arg(e->author()).arg(e->releaseDate().toString()).arg(tmp).arg(e->summary(lang)).arg(e->license()));
  }
-    
+
     if(installStatus(e) == 1) enabled = false;
     else enabled = true;
 
Index: entry.cpp
===================================================================
RCS file: /home/kde/kdelibs/knewstuff/entry.cpp,v
retrieving revision 1.7
diff -u -r1.7 entry.cpp
--- entry.cpp	8 Feb 2004 20:52:43 -0000	1.7
+++ entry.cpp	15 Jul 2004 18:12:29 -0000
@@ -93,12 +93,9 @@
 {
   if ( mSummaryMap.isEmpty() ) return QString::null;
 
-  if ( lang.isEmpty() ) {
-    if ( !mSummaryMap[ lang ].isEmpty() ) return mSummaryMap[ lang ];
-    else return *(mSummaryMap.begin());
-  } else {
-    return mSummaryMap[ lang ];
-  }
+  if ( !mSummaryMap[ lang ].isEmpty() ) return mSummaryMap[ lang ];
+  else if ( !mSummaryMap[ QString::null ].isEmpty() ) return mSummaryMap[ \
QString::null ]; +  else return *(mSummaryMap.begin());
 }
 
 
@@ -145,6 +142,7 @@
 KURL Entry::payload( const QString &lang ) const
 {
   KURL payload = mPayloadMap[ lang ];
+  if ( payload.isEmpty() ) payload = mPayloadMap [ QString::null ];
   if ( payload.isEmpty() && !mPayloadMap.isEmpty() ) {
     payload = *(mPayloadMap.begin());
   }
@@ -162,6 +160,7 @@
 KURL Entry::preview( const QString &lang ) const
 {
   KURL preview = mPreviewMap[ lang ];
+  if ( preview.isEmpty() ) preview = mPreviewMap [ QString::null ];
   if ( preview.isEmpty() && !mPreviewMap.isEmpty() ) {
     preview = *(mPreviewMap.begin());
   }
@@ -212,7 +211,7 @@
     if ( e.tagName() == "author" ) setAuthor( e.text().stripWhiteSpace() );
     if ( e.tagName() == "licence" ) setLicence( e.text().stripWhiteSpace() );
     if ( e.tagName() == "summary" ) {
-      QString lang = e.attribute( "lang " );
+      QString lang = e.attribute( "lang" );
       setSummary( e.text().stripWhiteSpace(), lang );
     }
     if ( e.tagName() == "version" ) setVersion( e.text().stripWhiteSpace() );
Index: uploaddialog.cpp
===================================================================
RCS file: /home/kde/kdelibs/knewstuff/uploaddialog.cpp,v
retrieving revision 1.9
diff -u -r1.9 uploaddialog.cpp
--- uploaddialog.cpp	20 May 2004 20:07:45 -0000	1.9
+++ uploaddialog.cpp	15 Jul 2004 18:12:30 -0000
@@ -88,7 +88,7 @@
   topLayout->addWidget( languageLabel, 5, 0 );
   mLanguageCombo = new QComboBox( topPage );
   topLayout->addWidget( mLanguageCombo, 5, 1 );
-  mLanguageCombo->insertStringList( KGlobal::locale()->languagesTwoAlpha() );
+  mLanguageCombo->insertStringList( KGlobal::locale()->languageList() );
 
   QLabel *previewLabel = new QLabel( i18n("Preview URL:"), topPage );
   topLayout->addWidget( previewLabel, 6, 0 );



_______________________________________________
kde-edu mailing list
kde-edu@mail.kde.org
https://mail.kde.org/mailman/listinfo/kde-edu


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic