Bug 262480 - "to:" and "from:" are not translatable
Summary: "to:" and "from:" are not translatable
Status: RESOLVED FIXED
Alias: None
Product: choqok
Classification: Unclassified
Component: general (show other bugs)
Version: SVN
Platform: Gentoo Packages Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Mehrdad Momeny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-08 01:49 UTC by Alexander Potashev
Modified: 2011-01-12 16:11 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Potashev 2011-01-08 01:49:55 UTC
Version:           latest svn snapshot (using KDE 4.5.95) 
OS:                Linux

1. click left mouse button on a username (for example, in Twitter), Choqok open a context menu
2. click "Posts from <username>" in the menu, Choqok opens a new tab entitled "from:<username>". "from:" in the tab title is not translatable, i.e. always in English.
The same applies to "to:".

Reproducible: Always
Comment 1 Alexander Potashev 2011-01-08 01:56:00 UTC
I'm thinking about using arrows here instead of words in Russian localization to save space, like "→username" (for "to:") and "←username" (for "from:"). But "Search results for →username" would look weird.
Comment 2 Alexander Potashev 2011-01-08 16:05:20 UTC
The current solution (https://projects.kde.org/projects/extragear/network/choqok/repository/revisions/5e297991d2d28f9c31a71388daa9d4a2481ed93c) does not work (with localization), because mSearchCode[ToUser] and mSearchCode[FromUser] are also used for HTTP requests.


I would also suggest using completely different strings for different types of searches instead of "Search results for %1", because "Search results for From:<username>" looks strange to me. (shall I open a new bug report or feature request?)
Comment 3 Mehrdad Momeny 2011-01-12 16:02:09 UTC
commit 2677da1fff8b7c00e031d3636bf5bfc6605213a4
branch 1.0
Author: Mehrdad Momeny <mehrdad.momeny@gmail.com>
Date:   Wed Jan 12 18:30:04 2011 +0330

    BUG:262480 "to:" and "from:" are translatable now
    CCBUG:262480

diff --git a/microblogs/twitter/twittersearch.cpp b/microblogs/twitter/twittersearch.cpp
index 9447e52..67124ef 100644
--- a/microblogs/twitter/twittersearch.cpp
+++ b/microblogs/twitter/twittersearch.cpp
@@ -42,6 +42,12 @@ TwitterSearch::TwitterSearch(QObject* parent): TwitterApiSearch(parent)
     mSearchCode[ReferenceUser] = '@';
     mSearchCode[ReferenceHashtag] = '#';
 
+    mI18nSearchCode[CustomSearch].clear();
+    mI18nSearchCode[ReferenceUser] = '@';
+    mI18nSearchCode[ReferenceHashtag] = '#';
+    mI18nSearchCode[ToUser] = i18nc("Posts sent to user", "To:");
+    mI18nSearchCode[FromUser] = i18nc("Posts from user, Sent by user", "From:");
+
     mSearchTypes[CustomSearch].first = i18n( "Custom Search" );
     mSearchTypes[CustomSearch].second = true;
 
@@ -187,7 +193,7 @@ QList< Choqok::Post* > TwitterSearch::parseAtom(const QByteArray& buffer)
 
 QString TwitterSearch::optionCode(int option)
 {
-    return mSearchCode[option];
+    return mI18nSearchCode[option];
 }
 
 TwitterSearch::~TwitterSearch()
diff --git a/microblogs/twitter/twittersearch.h b/microblogs/twitter/twittersearch.h
index e26bdc8..9df7219 100644
--- a/microblogs/twitter/twittersearch.h
+++ b/microblogs/twitter/twittersearch.h
@@ -58,6 +58,7 @@ protected:
     QList<Choqok::Post*> parseAtom( const QByteArray &buffer );
 
     QMap<int, QString> mSearchCode;
+    QMap<int, QString> mI18nSearchCode;
     QMap<KJob*, SearchInfo> mSearchJobs;
     static const QRegExp m_rId;
 };
Comment 4 Mehrdad Momeny 2011-01-12 16:02:09 UTC
commit 842d47e4c4d2a60b89a6b00670ec62faa1c46449
branch master
Author: Mehrdad Momeny <mehrdad.momeny@gmail.com>
Date:   Wed Jan 12 18:30:04 2011 +0330

    BUG:262480 "to:" and "from:" are translatable now
    CCBUG:262480

diff --git a/microblogs/twitter/twittersearch.cpp b/microblogs/twitter/twittersearch.cpp
index aea9b1b..eb4a114 100644
--- a/microblogs/twitter/twittersearch.cpp
+++ b/microblogs/twitter/twittersearch.cpp
@@ -37,11 +37,17 @@ TwitterSearch::TwitterSearch(QObject* parent): TwitterApiSearch(parent)
 {
     kDebug();
     mSearchCode[CustomSearch].clear();
-    mSearchCode[ToUser] = i18nc("Posts sent to user", "To:");
-    mSearchCode[FromUser] = i18nc("Posts from user, Sent by user", "From:");
+    mSearchCode[ToUser] = "to:";
+    mSearchCode[FromUser] = "from:";
     mSearchCode[ReferenceUser] = '@';
     mSearchCode[ReferenceHashtag] = '#';
 
+    mI18nSearchCode[CustomSearch].clear();
+    mI18nSearchCode[ReferenceUser] = '@';
+    mI18nSearchCode[ReferenceHashtag] = '#';
+    mI18nSearchCode[ToUser] = i18nc("Posts sent to user", "To:");
+    mI18nSearchCode[FromUser] = i18nc("Posts from user, Sent by user", "From:");
+
     mSearchTypes[CustomSearch].first = i18n( "Custom Search" );
     mSearchTypes[CustomSearch].second = true;
 
@@ -187,7 +193,7 @@ QList< Choqok::Post* > TwitterSearch::parseAtom(const QByteArray& buffer)
 
 QString TwitterSearch::optionCode(int option)
 {
-    return mSearchCode[option];
+    return mI18nSearchCode[option];
 }
 
 TwitterSearch::~TwitterSearch()
diff --git a/microblogs/twitter/twittersearch.h b/microblogs/twitter/twittersearch.h
index 744e1ea..1cc0ea9 100644
--- a/microblogs/twitter/twittersearch.h
+++ b/microblogs/twitter/twittersearch.h
@@ -58,6 +58,7 @@ protected:
     QList<Choqok::Post*> parseAtom( const QByteArray &buffer );
 
     QMap<int, QString> mSearchCode;
+    QMap<int, QString> mI18nSearchCode;
     QMap<KJob*, SearchInfo> mSearchJobs;
     static const QRegExp m_rId;
 };
Comment 5 Mehrdad Momeny 2011-01-12 16:11:57 UTC
but "→username" is not clear to me :/
FIXED in a better way :)