Skip to content

Commit

Permalink
Fix i18n in reply feed
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonflylee committed May 21, 2024
1 parent 4f546db commit 549cde0
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 50 deletions.
25 changes: 10 additions & 15 deletions resources/i18n/zh-Hans/wiliwili.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,26 +251,21 @@
"hint": "发个消息聊聊呗 ~",
"unknown": "暂不支持该消息"
},
"feed": {
"tab": {
"like": "收到的赞",
"at": "@我的",
"reply": "回复我的"
},
"like": {
"video": "赞了我的视频",
"reply": "赞了我的评论",
"article": "赞了我的文章"
"type": {
"video": "视频",
"reply": "评论",
"article": "文章",
"dynamic": "动态",
"album": "专辑"
},
"at": {
"video": "在视频中@了我",
"reply": "在评论中@了我",
"article": "在文章中@了我"
},
"reply": {
"video": "对我的视频发表了评论",
"reply": "回复我的评论",
"article": "对我的文章发表了评论"
}
"like": "赞了我的{}",
"at": "在{}中@了我",
"reply": "回复了我的{}"
},
"mine": {
"login": {
Expand Down
25 changes: 10 additions & 15 deletions resources/i18n/zh-Hant/wiliwili.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,26 +250,21 @@
"tab": "聊天列表",
"hint": "發個消息聊聊唄 ~"
},
"feed": {
"tab": {
"like": "收到的贊",
"at": "@我的",
"reply": "回覆我的"
},
"like": {
"video": "贊了我的視頻",
"reply": "贊了我的評論",
"article": "贊了我的文章"
"type": {
"video": "視頻",
"reply": "評論",
"article": "文章",
"dynamic": "動態",
"album": "专辑"
},
"at": {
"video": "在視頻中@了我",
"reply": "在評論中@了我",
"article": "在文章中@了我"
},
"reply": {
"video": "對我的視頻發表了評論",
"reply": "回覆我的評論",
"article": "對我的文章發表了評論"
}
"like": "贊了我的{}",
"at": "在{}中@了我",
"reply": "回覆我的{}"
},
"mine": {
"login": {
Expand Down
25 changes: 12 additions & 13 deletions resources/xml/activity/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,30 @@
alignItems="center"
positionType="absolute"
positionBottom="20">

<CustomButton
id="main/setting"
focusable="true"
highlightCornerRadius="50"
cornerRadius="50"
wireframe="false">
id="main/inbox"
focusable="true"
highlightCornerRadius="50"
cornerRadius="50"
wireframe="false">
<SVGImage
focusable="true"
width="48"
height="48"
SVG="@res/svg/ico-setting.svg"/>
SVG="@res/svg/ico-inbox.svg"/>
</CustomButton>

<CustomButton
id="main/inbox"
focusable="true"
highlightCornerRadius="50"
cornerRadius="50"
wireframe="false">
id="main/setting"
focusable="true"
highlightCornerRadius="50"
cornerRadius="50"
wireframe="false">
<SVGImage
focusable="true"
width="48"
height="48"
SVG="@res/svg/ico-inbox.svg"/>
SVG="@res/svg/ico-setting.svg"/>
</CustomButton>
</brls:Box>
</brls:Box>
Expand Down
6 changes: 3 additions & 3 deletions resources/xml/fragment/inbox_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@
id="inbox/chatList" />
</Tab>

<Tab label="@i18n/wiliwili/inbox/feed/reply"
<Tab label="@i18n/wiliwili/inbox/tab/reply"
fontSize="22">
<InboxFeed mode="reply" />
</Tab>

<Tab label="@i18n/wiliwili/inbox/feed/at"
<Tab label="@i18n/wiliwili/inbox/tab/at"
fontSize="22">
<InboxFeed mode="at" />
</Tab>

<Tab label="@i18n/wiliwili/inbox/feed/like"
<Tab label="@i18n/wiliwili/inbox/tab/like"
fontSize="22">
<InboxFeed mode="like" />
</Tab>
Expand Down
2 changes: 1 addition & 1 deletion resources/xml/views/inbox_msg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
id="msg/time"
fontSize="16"
singleLine="true"
marginBottom="4"
marginBottom="8"
horizontalAlign="center"
textColor="@theme/font/grey" />

Expand Down
10 changes: 7 additions & 3 deletions wiliwili/source/fragment/inbox_feed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "view/text_box.hpp"
#include "utils/image_helper.hpp"
#include "utils/activity_helper.hpp"
#include "utils/string_helper.hpp"

using namespace brls::literals;

Expand All @@ -20,25 +21,28 @@ class FeedCard : public RecyclingGridItem {

void setAuther(const bilibili::FeedLikeResult& r) {
std::vector<std::string> users;
std::string t = brls::getStr("wiliwili/inbox/type/" + r.item.type);
for (auto& s : r.users) users.push_back(s.nickname);
ImageHelper::with(this->avatar)->load(r.users.front().avatar + ImageHelper::face_ext);
this->labelAuthor->setText(pystring::join(",", users));
this->labelTime->setText(wiliwili::sec2date(r.like_time));
this->labelMisc->setText(brls::getStr("wiliwili/inbox/like/" + r.item.type));
this->labelMisc->setText(wiliwili::format("wiliwili/inbox/like"_i18n, t));
}

void setAuther(const bilibili::FeedAtResult& r) {
std::string t = brls::getStr("wiliwili/inbox/type/" + r.item.type);
ImageHelper::with(this->avatar)->load(r.user.avatar + ImageHelper::face_ext);
this->labelAuthor->setText(r.user.nickname);
this->labelTime->setText(wiliwili::sec2date(r.at_time));
this->labelMisc->setText(brls::getStr("wiliwili/inbox/at/" + r.item.type));
this->labelMisc->setText(wiliwili::format("wiliwili/inbox/at"_i18n, t));
}

void setAuther(const bilibili::FeedReplyResult& r) {
std::string t = brls::getStr("wiliwili/inbox/type/" + r.item.type);
ImageHelper::with(this->avatar)->load(r.user.avatar + ImageHelper::face_ext);
this->labelAuthor->setText(r.user.nickname);
this->labelTime->setText(wiliwili::sec2date(r.reply_time));
this->labelMisc->setText(brls::getStr("wiliwili/inbox/reply/" + r.item.type));
this->labelMisc->setText(wiliwili::format("wiliwili/inbox/reply"_i18n, t));
}

void prepareForReuse() override {
Expand Down

0 comments on commit 549cde0

Please sign in to comment.