|
From: Michael J. <mrm...@ho...> - 2008-01-17 14:05:57
|
> All plurals should be translated to TFN_("%1% user online", "%1% users on=
line", n) % n...also, all
> other parametrized strings should be translated to TF_("parameter %1% %2%=
") % value1 % value2...
> See boost format for more detailed formatting information (and check the =
mailing list archives for
> this list). This means that all calls to tformat should go away as well..=
.I'll wait with the patch
> until you get this in order.
Right, this patch is like the last one, but gets rid of all calls to tforma=
t, and as of which i have removed it from Text.h. I also changed my nick in=
a couple of places on this one.
> yes, you need to use the macros based on boost:format. take a look at
> DownloadsFrame.cpp on lines 114 and 116. also i'm not sure about the TFN_
> macro but it seems it's made to handle plurals automatically...
Thanks them examples helped :)
Just want to checking them though, as i not entirely certain of them.
QueueFrame.cpp
- TCHAR buf[64];
if(online> 0) {
if(getSources().size() =3D=3D 1) {
- display->columns[COLUMN_STATUS] =3D TSTRING(WAITING_USER_ONLINE);
+ display->columns[COLUMN_STATUS] =3D T_("Waiting (User online)");
} else {
- _sntprintf(buf, 64, CTSTRING(WAITING_USERS_ONLINE), online, getSourc=
es().size());
- display->columns[COLUMN_STATUS] =3D buf;
+ display->columns[COLUMN_STATUS] =3D str(TF_("Waiting (%1% of %2% use=
rs online)") % online % getSources().size());
}
} else {
if(getSources().size() =3D=3D 0) {
- display->columns[COLUMN_STATUS] =3D TSTRING(NO_USERS_TO_DOWNLOAD_FRO=
M);
+ display->columns[COLUMN_STATUS] =3D T_("No users to download from");
} else if(getSources().size() =3D=3D 1) {
- display->columns[COLUMN_STATUS] =3D TSTRING(USER_OFFLINE);
- } else if(getSources().size() =3D=3D 2) {
- display->columns[COLUMN_STATUS] =3D TSTRING(BOTH_USERS_OFFLINE);
- } else if(getSources().size() =3D=3D 3) {
- display->columns[COLUMN_STATUS] =3D TSTRING(ALL_3_USERS_OFFLINE);
- } else if(getSources().size() =3D=3D 4) {
- display->columns[COLUMN_STATUS] =3D TSTRING(ALL_4_USERS_OFFLINE);
+ display->columns[COLUMN_STATUS] =3D T_("User offline");
} else {
- _sntprintf(buf, 64, CTSTRING(ALL_USERS_OFFLINE), getSources().size()=
);
- display->columns[COLUMN_STATUS] =3D buf;
+ display->columns[COLUMN_STATUS] =3D str(TF_("All %1% users offline")=
% getSources().size());
}
The reason i have left the if =3D=3D 1 in here, and used TF_ for the plural=
part is because off the numbers of arguments after it. Which causes some B=
oost exceptions to be thrown. E.g. in the top one, 0 of the arguments are =
used, but the>1 part uses 2 arguments.
TransferView.cpp
- statusString +=3D Text::tformat(TSTRING(DOWNLOADED_BYTES), pos.c_str(), =
percent, elapsed.c_str());
+ statusString +=3D str(TF_("Downloaded %1% (%|2$.1f|%%) in %3%") % pos % =
percent % elapsed);
- statusString +=3D Text::tformat(TSTRING(UPLOADED_BYTES), pos.c_str(), pe=
rcent, elapsed.c_str());
+ statusString +=3D str(TF_("Uploaded %1% (%|2$.1f|%%) in %3%") % pos % pe=
rcent % elapsed);
Heh, these were a nightmare to get working. :(
I also deleted this, because nothing was using it:
void TransferView::on(UploadManagerListener::Tick, const UploadList& ul) t=
hrow() {
- AutoArray buf(TSTRING(UPLOADED_BYTES).size() + 64);
Directorylistingframe.cpp
- setStatus(STATUS_STATUS, Text::tformat(TSTRING(MATCHED_FILES), matched));
+ setStatus(STATUS_STATUS, str(TFN_("Matched %1% file", "Matched %1% files"=
, matched) % matched));
Searchframe.cpp
- tstring msg =3D Text::tformat(TSTRING(SEARCHING_WAIT), waitFor);
+ tstring msg =3D str(TFN_("Searching too soon, next search in %1% second"=
, "Searching too soon, next search in %1% seconds", waitFor) % waitFor);
=20
thanks
MikeJJ
_________________________________________________________________
Who's friends with who and co-starred in what?
http://www.searchgamesbox.com/celebrityseparation.shtml=
|