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'; import localDb from '../localDb';
const MAX_INT_32 = 2 ** 31 - 1; 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({ export function updateProfile({
firstName, firstName,

View File

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

View File

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

View File

@ -96,7 +96,9 @@ const SettingsPrivacyActiveSessions: FC<OwnProps & StateProps & DispatchProps> =
function renderOtherSessions(sessions: ApiSession[]) { function renderOtherSessions(sessions: ApiSession[]) {
return ( return (
<div className="settings-item"> <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)} {sessions.map(renderSession)}
</div> </div>

View File

@ -141,6 +141,7 @@ export const DEFAULT_LANG_CODE = 'en';
export const DEFAULT_LANG_PACK = 'android'; export const DEFAULT_LANG_PACK = 'android';
export const LANG_PACKS = ['android', 'ios', 'tdesktop', 'macos'] as const; export const LANG_PACKS = ['android', 'ios', 'tdesktop', 'macos'] as const;
export const TIPS_USERNAME = 'TelegramTips'; 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 FEEDBACK_URL = 'https://bugs.telegram.org/?tag_ids=41&sort=time';
export const LIGHT_THEME_BG_COLOR = '#A2AF8E'; export const LIGHT_THEME_BG_COLOR = '#A2AF8E';
export const DARK_THEME_BG_COLOR = '#0F0F0F'; export const DARK_THEME_BG_COLOR = '#0F0F0F';

View File

@ -15,6 +15,7 @@ import {
RE_TME_INVITE_LINK, RE_TME_INVITE_LINK,
RE_TME_LINK, RE_TME_LINK,
TIPS_USERNAME, TIPS_USERNAME,
LOCALIZED_TIPS,
} from '../../../config'; } from '../../../config';
import { callApi } from '../../../api/gramjs'; import { callApi } from '../../../api/gramjs';
import { import {
@ -131,8 +132,14 @@ addReducer('openSupportChat', (global, actions) => {
})(); })();
}); });
addReducer('openTipsChat', (global, actions) => { addReducer('openTipsChat', (global, actions, payload) => {
actions.openChatByUsername({ username: TIPS_USERNAME }); 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) => { addReducer('loadMoreChats', (global, actions, payload) => {