Translation: Localized Telegram Tips, add more localizations (#1340)

This commit is contained in:
Alexander Zinchuk 2021-08-03 01:30:53 +03:00
parent 810d85b3a5
commit 2d351ce7bc
6 changed files with 24 additions and 10 deletions

View File

@ -20,7 +20,7 @@ import { buildCollectionByKey } from '../../../util/iteratees';
import localDb from '../localDb';
const MAX_INT_32 = 2 ** 31 - 1;
const BETA_LANG_CODES = ['ar', 'fa'];
const BETA_LANG_CODES = ['ar', 'fa', 'id', 'ko', 'uz'];
export function updateProfile({
firstName,

View File

@ -166,6 +166,10 @@ const LeftMainHeader: FC<OwnProps & StateProps & DispatchProps> = ({
disableHistoryBack();
};
const handleOpenTipsChat = () => {
openTipsChat({ langCode: lang.code });
};
const isSearchFocused = (
Boolean(globalSearchChatId)
|| content === LeftColumnContent.GlobalSearch
@ -235,7 +239,7 @@ const LeftMainHeader: FC<OwnProps & StateProps & DispatchProps> = ({
</MenuItem>
<MenuItem
icon="help"
onClick={openTipsChat}
onClick={handleOpenTipsChat}
>
{lang('TelegramFeatures')}
</MenuItem>

View File

@ -167,7 +167,7 @@ const SettingsHeader: FC<OwnProps & DispatchProps> = ({
positionX="right"
>
<MenuItem icon="delete" destructive onClick={openDeleteFolderConfirmation}>
Delete Folder
{lang('Delete')}
</MenuItem>
</DropdownMenu>
)}
@ -228,16 +228,16 @@ const SettingsHeader: FC<OwnProps & DispatchProps> = ({
<ConfirmDialog
isOpen={isSignOutDialogOpen}
onClose={closeSignOutConfirmation}
text="Are you sure you want to log out?"
confirmLabel="Log Out"
text={lang('lng_sure_logout')}
confirmLabel={lang('AccountSettings.Logout')}
confirmHandler={handleSignOutMessage}
confirmIsDestructive
/>
<ConfirmDialog
isOpen={isDeleteFolderDialogOpen}
onClose={closeDeleteFolderConfirmation}
text="Are you sure you want to delete this folder?"
confirmLabel="Delete"
text={lang('FilterDeleteAlert')}
confirmLabel={lang('Delete')}
confirmHandler={handleDeleteFolderMessage}
confirmIsDestructive
/>

View File

@ -96,7 +96,9 @@ const SettingsPrivacyActiveSessions: FC<OwnProps & StateProps & DispatchProps> =
function renderOtherSessions(sessions: ApiSession[]) {
return (
<div className="settings-item">
<h4 className="settings-item-header mb-4" dir={lang.isRtl ? 'rtl' : undefined}>Other Sessions</h4>
<h4 className="settings-item-header mb-4" dir={lang.isRtl ? 'rtl' : undefined}>
{lang('OtherSessions')}
</h4>
{sessions.map(renderSession)}
</div>

View File

@ -141,6 +141,7 @@ export const DEFAULT_LANG_CODE = 'en';
export const DEFAULT_LANG_PACK = 'android';
export const LANG_PACKS = ['android', 'ios', 'tdesktop', 'macos'] as const;
export const TIPS_USERNAME = 'TelegramTips';
export const LOCALIZED_TIPS = ['ar', 'pt-br', 'id', 'it', 'ko', 'ms', 'pl', 'es', 'tr'];
export const FEEDBACK_URL = 'https://bugs.telegram.org/?tag_ids=41&sort=time';
export const LIGHT_THEME_BG_COLOR = '#A2AF8E';
export const DARK_THEME_BG_COLOR = '#0F0F0F';

View File

@ -15,6 +15,7 @@ import {
RE_TME_INVITE_LINK,
RE_TME_LINK,
TIPS_USERNAME,
LOCALIZED_TIPS,
} from '../../../config';
import { callApi } from '../../../api/gramjs';
import {
@ -131,8 +132,14 @@ addReducer('openSupportChat', (global, actions) => {
})();
});
addReducer('openTipsChat', (global, actions) => {
actions.openChatByUsername({ username: TIPS_USERNAME });
addReducer('openTipsChat', (global, actions, payload) => {
const { langCode } = payload;
const usernamePostfix = langCode === 'pt-br'
? 'BR'
: LOCALIZED_TIPS.includes(langCode) ? (langCode as string).toUpperCase() : '';
actions.openChatByUsername({ username: `${TIPS_USERNAME}${usernamePostfix}` });
});
addReducer('loadMoreChats', (global, actions, payload) => {