Merge commit '44cd88adc4e2f4028dcc2b08b98368f0dc90cee4' into glitch-soc/merge-upstream

Conflicts:
- `.github/dependabot.yml`:
  Updated upstream, but we've deleted it.
  Keep it deleted.
- `app/javascript/mastodon/locales/index.js`:
  Reworked upstream, but the code was mostly in
  `app/javascript/locales/index.js` in glitch-soc.
  Updated that file accordingly.
- `app/javascript/packs/public.jsx`:
  Not a real conflict, but different imports in
  glitch-soc and upstream.
- `app/views/layouts/application.html.haml`:
  Conflict due to locales loading and theme system
  discrepancies.
  Updated in our own way.
- `app/views/layouts/embedded.html.haml`:
  Conflict due to locales loading and theme system
  discrepancies.
  Updated in our own way.
- `config/webpack/generateLocalePacks.js`:
  Deleted upstream, as upstream now directly loads the
  JSON at runtime.
  Deleted as well, will switch to runtime loading in
  an upcoming commit.
- `config/webpack/shared.js`:
  Not a real conflict, but different imports in
  glitch-soc and upstream.
- `config/webpack/translationRunner.js`:
  Mostly deleted upstream, to be replaced with `formatjs-formatter.js`
  instead.
  Moved the glitch-soc logic there and deleted the file.
main
Claire 2023-06-10 11:15:05 +02:00
commit 85722a918d
130 changed files with 420 additions and 5081 deletions

View File

@ -293,6 +293,7 @@ module.exports = {
'.*rc.js',
'ide-helper.js',
'config/webpack/**/*',
'config/formatjs-formatter.js',
],
env: {

View File

@ -41,8 +41,7 @@ jobs:
- name: Check for missing strings in English JSON
run: |
yarn build:development
yarn manage:translations en
yarn i18n:extract --throws
git diff --exit-code
- name: Check locale file normalization

View File

@ -7,3 +7,16 @@ export function setLocale(locale) {
export function getLocale() {
return theLocale;
}
export function onProviderError(error) {
// Silent the error, like upstream does
if(process.env.NODE_ENV === 'production') return;
// This browser does not advertise Intl support for this locale, we only print a warning
// As-per the spec, the browser should select the best matching locale
if(typeof error === "object" && error.message.match("MISSING_DATA")) {
console.warn(error.message);
}
console.error(error);
}

View File

@ -1,4 +1,4 @@
import IntlMessageFormat from 'intl-messageformat';
import { IntlMessageFormat } from 'intl-messageformat';
import { defineMessages } from 'react-intl';
import { List as ImmutableList } from 'immutable';

View File

@ -1,7 +1,6 @@
import { useCallback } from 'react';
import type { InjectedIntl } from 'react-intl';
import { defineMessages, injectIntl } from 'react-intl';
import { defineMessages, useIntl } from 'react-intl';
import { IconButton } from './icon_button';
@ -15,9 +14,11 @@ const messages = defineMessages({
interface Props {
domain: string;
onUnblockDomain: (domain: string) => void;
intl: InjectedIntl;
}
const _Domain: React.FC<Props> = ({ domain, onUnblockDomain, intl }) => {
export const Domain: React.FC<Props> = ({ domain, onUnblockDomain }) => {
const intl = useIntl();
const handleDomainUnblock = useCallback(() => {
onUnblockDomain(domain);
}, [domain, onUnblockDomain]);
@ -41,5 +42,3 @@ const _Domain: React.FC<Props> = ({ domain, onUnblockDomain, intl }) => {
</div>
);
};
export const Domain = injectIntl(_Domain);

View File

@ -1,7 +1,6 @@
import { useCallback } from 'react';
import type { InjectedIntl } from 'react-intl';
import { injectIntl, defineMessages } from 'react-intl';
import { useIntl, defineMessages } from 'react-intl';
import { Icon } from 'mastodon/components/icon';
@ -13,10 +12,11 @@ interface Props {
disabled: boolean;
maxId: string;
onClick: (maxId: string) => void;
intl: InjectedIntl;
}
const _LoadGap: React.FC<Props> = ({ disabled, maxId, onClick, intl }) => {
export const LoadGap: React.FC<Props> = ({ disabled, maxId, onClick }) => {
const intl = useIntl();
const handleClick = useCallback(() => {
onClick(maxId);
}, [maxId, onClick]);
@ -32,5 +32,3 @@ const _LoadGap: React.FC<Props> = ({ disabled, maxId, onClick, intl }) => {
</button>
);
};
export const LoadGap = injectIntl(_LoadGap);

View File

@ -1,6 +1,6 @@
import { Component } from 'react';
import type { InjectedIntl } from 'react-intl';
import type { IntlShape } from 'react-intl';
import { injectIntl, defineMessages } from 'react-intl';
const messages = defineMessages({
@ -103,7 +103,7 @@ const getUnitDelay = (units: string) => {
};
export const timeAgoString = (
intl: InjectedIntl,
intl: IntlShape,
date: Date,
now: number,
year: number,
@ -155,7 +155,7 @@ export const timeAgoString = (
};
const timeRemainingString = (
intl: InjectedIntl,
intl: IntlShape,
date: Date,
now: number,
timeGiven = true
@ -190,7 +190,7 @@ const timeRemainingString = (
};
interface Props {
intl: InjectedIntl;
intl: IntlShape;
timestamp: string;
year: number;
futureDate?: boolean;
@ -201,7 +201,7 @@ interface States {
}
class RelativeTimestamp extends Component<Props, States> {
state = {
now: this.props.intl.now(),
now: Date.now(),
};
static defaultProps = {
@ -223,7 +223,7 @@ class RelativeTimestamp extends Component<Props, States> {
UNSAFE_componentWillReceiveProps(nextProps: Props) {
if (this.props.timestamp !== nextProps.timestamp) {
this.setState({ now: this.props.intl.now() });
this.setState({ now: Date.now() });
}
}
@ -253,7 +253,7 @@ class RelativeTimestamp extends Component<Props, States> {
: Math.max(updateInterval, unitRemainder);
this._timer = window.setTimeout(() => {
this.setState({ now: this.props.intl.now() });
this.setState({ now: Date.now() });
}, delay);
}

View File

@ -1,12 +1,11 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import { IntlProvider, addLocaleData } from 'react-intl';
import { IntlProvider } from 'react-intl';
import { getLocale } from '../locales';
import { getLocale, onProviderError } from '../locales';
const { localeData, messages } = getLocale();
addLocaleData(localeData);
const { messages } = getLocale();
export default class AdminComponent extends PureComponent {
@ -19,7 +18,7 @@ export default class AdminComponent extends PureComponent {
const { locale, children } = this.props;
return (
<IntlProvider locale={locale} messages={messages}>
<IntlProvider locale={locale} messages={messages} onError={onProviderError}>
{children}
</IntlProvider>
);

View File

@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import { IntlProvider, addLocaleData } from 'react-intl';
import { IntlProvider } from 'react-intl';
import { Provider } from 'react-redux';
@ -9,11 +9,10 @@ import { fetchCustomEmojis } from '../actions/custom_emojis';
import { hydrateStore } from '../actions/store';
import Compose from '../features/standalone/compose';
import initialState from '../initial_state';
import { getLocale } from '../locales';
import { getLocale, onProviderError } from '../locales';
import { store } from '../store';
const { localeData, messages } = getLocale();
addLocaleData(localeData);
const { messages } = getLocale();
if (initialState) {
store.dispatch(hydrateStore(initialState));
@ -31,7 +30,7 @@ export default class TimelineContainer extends PureComponent {
const { locale } = this.props;
return (
<IntlProvider locale={locale} messages={messages}>
<IntlProvider locale={locale} messages={messages} onError={onProviderError}>
<Provider store={store}>
<Compose />
</Provider>

View File

@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import { IntlProvider, addLocaleData } from 'react-intl';
import { IntlProvider } from 'react-intl';
import { Helmet } from 'react-helmet';
import { BrowserRouter, Route } from 'react-router-dom';
@ -16,11 +16,10 @@ import { connectUserStream } from 'mastodon/actions/streaming';
import ErrorBoundary from 'mastodon/components/error_boundary';
import UI from 'mastodon/features/ui';
import initialState, { title as siteTitle } from 'mastodon/initial_state';
import { getLocale } from 'mastodon/locales';
import { getLocale, onProviderError } from 'mastodon/locales';
import { store } from 'mastodon/store';
const { localeData, messages } = getLocale();
addLocaleData(localeData);
const { messages } = getLocale();
const title = process.env.NODE_ENV === 'production' ? siteTitle : `${siteTitle} (Dev)`;
@ -83,7 +82,7 @@ export default class Mastodon extends PureComponent {
const { locale } = this.props;
return (
<IntlProvider locale={locale} messages={messages}>
<IntlProvider locale={locale} messages={messages} onError={onProviderError}>
<ReduxProvider store={store}>
<ErrorBoundary>
<BrowserRouter>

View File

@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import { createPortal } from 'react-dom';
import { IntlProvider, addLocaleData } from 'react-intl';
import { IntlProvider } from 'react-intl';
import { fromJS } from 'immutable';
@ -14,11 +14,10 @@ import Audio from 'mastodon/features/audio';
import Card from 'mastodon/features/status/components/card';
import MediaModal from 'mastodon/features/ui/components/media_modal';
import Video from 'mastodon/features/video';
import { getLocale } from 'mastodon/locales';
import { getLocale, onProviderError } from 'mastodon/locales';
import { getScrollbarWidth } from 'mastodon/utils/scrollbar';
const { localeData, messages } = getLocale();
addLocaleData(localeData);
const { messages } = getLocale();
const MEDIA_COMPONENTS = { MediaGallery, Video, Card, Poll, Hashtag, Audio };
@ -84,7 +83,7 @@ export default class MediaContainer extends PureComponent {
}
return (
<IntlProvider locale={locale} messages={messages}>
<IntlProvider locale={locale} messages={messages} onError={onProviderError}>
<>
{[].map.call(components, (component, i) => {
const componentName = component.getAttribute('data-component');

View File

@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import { FormattedMessage, FormattedHTMLMessage } from 'react-intl';
import { FormattedMessage } from 'react-intl';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
@ -77,7 +77,7 @@ class Follows extends PureComponent {
{loadedContent}
</div>
<p className='onboarding__lead'><FormattedHTMLMessage id='onboarding.tips.accounts_from_other_servers' defaultMessage='<strong>Did you know?</strong> Since Mastodon is decentralized, some profiles you come across will be hosted on servers other than yours. And yet you can interact with them seamlessly! Their server is in the second half of their username!' /></p>
<p className='onboarding__lead'><FormattedMessage id='onboarding.tips.accounts_from_other_servers' defaultMessage='<strong>Did you know?</strong> Since Mastodon is decentralized, some profiles you come across will be hosted on servers other than yours. And yet you can interact with them seamlessly! Their server is in the second half of their username!' values={{ strong: chunks => <strong>{chunks}</strong> }} /></p>
<div className='onboarding__footer'>
<button className='link-button' onClick={onBack}><FormattedMessage id='onboarding.actions.back' defaultMessage='Take me back' /></button>

View File

@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import { PureComponent } from 'react';
import { defineMessages, injectIntl, FormattedMessage, FormattedHTMLMessage } from 'react-intl';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import { Link } from 'react-router-dom';
@ -168,9 +168,9 @@ class Share extends PureComponent {
<CopyPasteText value={intl.formatMessage(messages.shareableMessage, { username: `@${account.get('username')}@${domain}`, url })} />
<TipCarousel>
<div><p className='onboarding__lead'><FormattedHTMLMessage id='onboarding.tips.verification' defaultMessage='<strong>Did you know?</strong> You can verify your account by putting a link to your Mastodon profile on your own website and adding the website to your profile. No fees or documents necessary!' /></p></div>
<div><p className='onboarding__lead'><FormattedHTMLMessage id='onboarding.tips.migration' defaultMessage='<strong>Did you know?</strong> If you feel like {domain} is not a great server choice for you in the future, you can move to another Mastodon server without losing your followers. You can even host your own server!' values={{ domain }} /></p></div>
<div><p className='onboarding__lead'><FormattedHTMLMessage id='onboarding.tips.2fa' defaultMessage='<strong>Did you know?</strong> You can secure your account by setting up two-factor authentication in your account settings. It works with any TOTP app of your choice, no phone number necessary!' /></p></div>
<div><p className='onboarding__lead'><FormattedMessage id='onboarding.tips.verification' defaultMessage='<strong>Did you know?</strong> You can verify your account by putting a link to your Mastodon profile on your own website and adding the website to your profile. No fees or documents necessary!' values={{ strong: chunks => <strong>{chunks}</strong> }} /></p></div>
<div><p className='onboarding__lead'><FormattedMessage id='onboarding.tips.migration' defaultMessage='<strong>Did you know?</strong> If you feel like {domain} is not a great server choice for you in the future, you can move to another Mastodon server without losing your followers. You can even host your own server!' values={{ domain, strong: chunks => <strong>{chunks}</strong> }} /></p></div>
<div><p className='onboarding__lead'><FormattedMessage id='onboarding.tips.2fa' defaultMessage='<strong>Did you know?</strong> You can secure your account by setting up two-factor authentication in your account settings. It works with any TOTP app of your choice, no phone number necessary!' values={{ strong: chunks => <strong>{chunks}</strong> }} /></p></div>
</TipCarousel>
<p className='onboarding__lead'><FormattedMessage id='onboarding.share.next_steps' defaultMessage='Possible next steps:' /></p>

View File

@ -0,0 +1,14 @@
import { setLocale } from "./locales";
export async function loadLocale() {
const locale = document.querySelector('html').lang || 'en';
const localeData = await import(
/* webpackMode: "lazy" */
/* webpackChunkName: "locales/vanilla/[request]" */
/* webpackInclude: /\.json$/ */
/* webpackPreload: true */
`mastodon/locales/${locale}.json`);
setLocale({ messages: localeData });
}

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,5 +0,0 @@
[
"account.badges.bot",
"compose_form.publish_loud",
"search_results.hashtags"
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

View File

@ -1,2 +0,0 @@
[
]

Some files were not shown because too many files have changed in this diff Show More