Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update i18n for memo visibility #233

Merged
merged 1 commit into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion web/src/components/MemoCardDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
});
const [linkMemos, setLinkMemos] = useState<LinkedMemo[]>([]);
const [linkedMemos, setLinkedMemos] = useState<LinkedMemo[]>([]);
const visibilitySelectorItems = VISIBILITY_SELECTOR_ITEMS.map((item) => {
return {
value: item.value,
text: t(`memo.visibility.${item.text.toLowerCase()}`),
};
});

useEffect(() => {
const fetchLinkedMemos = async () => {
Expand Down Expand Up @@ -148,7 +154,7 @@ const MemoCardDialog: React.FC<Props> = (props: Props) => {
<Icon.Eye className="icon-img" />
<Selector
className="visibility-selector"
dataSource={VISIBILITY_SELECTOR_ITEMS}
dataSource={visibilitySelectorItems}
value={memo.visibility}
handleValueChanged={(value) => handleVisibilitySelectorChange(value as Visibility)}
/>
Expand Down
8 changes: 7 additions & 1 deletion web/src/components/Settings/PreferencesSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const editorFontStyleSelectorItems = [
const PreferencesSection = () => {
const { t } = useTranslation();
const { setting } = useAppSelector((state) => state.user.user as User);
const visibilitySelectorItems = VISIBILITY_SELECTOR_ITEMS.map((item) => {
return {
value: item.value,
text: t(`memo.visibility.${item.text.toLowerCase()}`),
};
});

const handleLocaleChanged = async (value: string) => {
await userService.upsertUserSetting("locale", value);
Expand Down Expand Up @@ -61,7 +67,7 @@ const PreferencesSection = () => {
<Selector
className="ml-2 w-32"
value={setting.memoVisibility}
dataSource={VISIBILITY_SELECTOR_ITEMS}
dataSource={visibilitySelectorItems}
handleValueChanged={handleDefaultMemoVisibilityChanged}
/>
</label>
Expand Down
7 changes: 6 additions & 1 deletion web/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@
"cant-empty": "Content can't be empty"
},
"memo": {
"view-story": "View Story"
"view-story": "View Story",
"visibility": {
"private": "Private",
"protected": "Protected",
"public": "Public"
}
},
"memo-list": {
"fetching-data": "fetching data..."
Expand Down
7 changes: 6 additions & 1 deletion web/src/locales/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@
"cant-empty": "Nội dung không thể trống"
},
"memo": {
"view-story": "Xem nội dung"
"view-story": "Xem nội dung",
"visibility": {
"private": "Private",
"protected": "Protected",
"public": "Public"
}
},
"memo-list": {
"fetching-data": "đang tải dữ liệu..."
Expand Down
7 changes: 6 additions & 1 deletion web/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@
"cant-empty": "Content can't be empty"
},
"memo": {
"view-story": "查看详情"
"view-story": "查看详情",
"visibility": {
"private": "仅自己可见",
"protected": "对所有用户公开",
"public": "对互联网公开"
}
},
"memo-list": {
"fetching-data": "请求数据中..."
Expand Down