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: remove unused localisation content #2904

Merged
merged 7 commits into from
Jan 11, 2024
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
137 changes: 1 addition & 136 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"react": "18.2.0",
"react-app-polyfill": "3.0.0",
"react-dom": "18.2.0",
"react-intl": "6.4.4",
"react-redux": "8.1.3",
"redux": "4.2.1",
"redux-thunk": "2.4.2",
Expand Down Expand Up @@ -99,7 +98,6 @@
"@types/lodash.debounce": "4.0.7",
"@types/react": "18.2.24",
"@types/react-dom": "18.2.8",
"@types/react-intl": "3.0.0",
"@types/react-redux": "7.1.23",
"@types/redux-logger": "3.0.9",
"@types/redux-mock-store": "1.0.3",
Expand Down
4 changes: 1 addition & 3 deletions src/app/services/actions/permissions-action-creator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { MessageBarType } from '@fluentui/react';

import { geLocale } from '../../../appLocale';
import { authenticationWrapper } from '../../../modules/authentication';
import { AppAction } from '../../../types/action';
import { IUser } from '../../../types/profile';
Expand Down Expand Up @@ -136,8 +135,7 @@ export function fetchScopes(scopesFetchType: ScopesFetchType = 'full') {
}

const headers = {
'Content-Type': 'application/json',
'Accept-Language': geLocale
'Content-Type': 'application/json'
};

const options: IRequestOptions = { headers };
Expand Down
4 changes: 1 addition & 3 deletions src/app/services/actions/samples-action-creators.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { geLocale } from '../../../appLocale';
import { samplesCache } from '../../../modules/cache/samples.cache';
import { AppDispatch } from '../../../store';
import { AppAction } from '../../../types/action';
Expand Down Expand Up @@ -41,8 +40,7 @@ export function fetchSamples() {
: `${samplesUrl}`;

const headers = {
'Content-Type': 'application/json',
'Accept-Language': geLocale
'Content-Type': 'application/json'
};

const options: IRequestOptions = { headers };
Expand Down
5 changes: 0 additions & 5 deletions src/app/utils/translate-messages.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import { geLocale } from '../../appLocale';
import messages from '../../messages';

export function translateMessage(messageId: string): string {
const translatedMessage = getTranslation(messageId, geLocale);
if (translatedMessage) {
return translatedMessage;
}
return getTranslation(messageId, 'en-US') || messageId;
}

Expand Down
7 changes: 2 additions & 5 deletions src/app/views/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Announced, getTheme, ITheme, styled } from '@fluentui/react';
import { Resizable } from 're-resizable';
import { Component } from 'react';
import { injectIntl } from 'react-intl';
import { connect } from 'react-redux';
import { bindActionCreators, Dispatch } from 'redux';

Expand Down Expand Up @@ -43,7 +42,6 @@ import { ValidationProvider } from '../services/context/validation-context/Valid
export interface IAppProps {
theme?: ITheme;
styles?: object;
intl: any;
profile: object;
graphExplorerMode: Mode;
sidebarProperties: ISidebarProps;
Expand Down Expand Up @@ -476,7 +474,7 @@ class App extends Component<IAppProps, IAppState> {
<div style={mobileScreen ? this.statusAreaMobileStyle : this.statusAreaFullScreenStyle}>
<StatusMessages />
</div>
<QueryResponse verb={this.state.selectedVerb} />
<QueryResponse />
</div>
</ValidationProvider>
</Resizable>
Expand Down Expand Up @@ -529,7 +527,6 @@ const mapDispatchToProps = (dispatch: Dispatch) => {
};

const StyledApp = styled(App, appStyles as any);
const IntlApp = injectIntl(StyledApp);

//@ts-ignore
export default connect(mapStateToProps, mapDispatchToProps)(IntlApp);
export default connect(mapStateToProps, mapDispatchToProps)(StyledApp);
12 changes: 6 additions & 6 deletions src/app/views/app-sections/HeaderMessaging.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Link, MessageBar, MessageBarType } from '@fluentui/react';
import { FormattedMessage } from 'react-intl';

import { getLoginType } from '../../../modules/authentication/authUtils';
import { LoginType } from '../../../types/enums';
import { translateMessage } from '../../utils/translate-messages';

export function headerMessaging(query: string): React.ReactNode {
const loginType = getLoginType();
Expand All @@ -12,23 +12,23 @@ export function headerMessaging(query: string): React.ReactNode {
{loginType === LoginType.Popup && <>
<MessageBar messageBarType={MessageBarType.info} isMultiline={true}>
<p>
<FormattedMessage id='To try the full features' />,
{translateMessage('To try the full features')},
<Link tabIndex={0} href={query} target='_blank' rel='noopener noreferrer' underline>
<FormattedMessage id='full Graph Explorer' />.
{translateMessage('full Graph Explorer')}.
</Link>
</p>
<p>
<FormattedMessage id='running the query' />.
{translateMessage('running the query')}.
</p>
</MessageBar>

</>}
{loginType === LoginType.Redirect && <MessageBar messageBarType={MessageBarType.warning} isMultiline={true}>
<p>
<FormattedMessage id='To try operations other than GET' />,
{translateMessage('To try operations other than GET')},

<Link tabIndex={0} href={query} target='_blank' rel='noopener noreferrer' underline>
<FormattedMessage id='sign in' />.
{translateMessage('sign in')}.
</Link>
</p>
</MessageBar>}
Expand Down
12 changes: 6 additions & 6 deletions src/app/views/app-sections/StatusMessages.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { Link, MessageBar } from '@fluentui/react';
import { Fragment } from 'react';
import { FormattedMessage } from 'react-intl';
import { useDispatch } from 'react-redux';

import { IQuery } from '../../../types/query-runner';
import { AppDispatch, useAppSelector } from '../../../store';
import { IQuery } from '../../../types/query-runner';
import { setSampleQuery } from '../../services/actions/query-input-action-creators';
import { clearQueryStatus } from '../../services/actions/query-status-action-creator';
import { GRAPH_URL } from '../../services/graph-constants';
import {
convertArrayToObject, extractUrl, getMatchesAndParts,
matchIncludesLink, replaceLinks
} from '../../utils/status-message';
import { translateMessage } from '../../utils/translate-messages';

const StatusMessages = () => {
const dispatch: AppDispatch = useDispatch();
Expand Down Expand Up @@ -70,15 +70,15 @@ const StatusMessages = () => {
{`${statusText} - `}{displayStatusMessage(message, urls)}

{duration && <>
{` - ${duration}`}<FormattedMessage id='milliseconds' />
{` - ${duration} ${translateMessage('milliseconds')}`}
</>}

{status === 403 && <>.
<FormattedMessage id='consent to scopes' />
{translateMessage('consent to scopes')}
<span style={{ fontWeight: 600 }}>
<FormattedMessage id='modify permissions' />
{translateMessage('modify permissions')}
</span>
<FormattedMessage id='tab' />
{translateMessage('tab')}
</>}

{hint && <div>{hint}</div>}
Expand Down
Loading
Loading