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.
local
Claire 11 months ago
commit 85722a918d
  1. 1
      .eslintrc.js
  2. 3
      .github/workflows/check-i18n.yml
  3. 13
      app/javascript/locales/index.js
  4. 2
      app/javascript/mastodon/actions/notifications.js
  5. 11
      app/javascript/mastodon/components/domain.tsx
  6. 10
      app/javascript/mastodon/components/load_gap.tsx
  7. 14
      app/javascript/mastodon/components/relative_timestamp.tsx
  8. 9
      app/javascript/mastodon/containers/admin_component.jsx
  9. 9
      app/javascript/mastodon/containers/compose_container.jsx
  10. 9
      app/javascript/mastodon/containers/mastodon.jsx
  11. 9
      app/javascript/mastodon/containers/media_container.jsx
  12. 4
      app/javascript/mastodon/features/onboarding/follows.jsx
  13. 8
      app/javascript/mastodon/features/onboarding/share.jsx
  14. 14
      app/javascript/mastodon/load_locale.js
  15. 4484
      app/javascript/mastodon/locales/defaultMessages.json
  16. 2
      app/javascript/mastodon/locales/whitelist_af.json
  17. 2
      app/javascript/mastodon/locales/whitelist_an.json
  18. 2
      app/javascript/mastodon/locales/whitelist_ar.json
  19. 2
      app/javascript/mastodon/locales/whitelist_ast.json
  20. 2
      app/javascript/mastodon/locales/whitelist_be.json
  21. 2
      app/javascript/mastodon/locales/whitelist_bg.json
  22. 2
      app/javascript/mastodon/locales/whitelist_bn.json
  23. 2
      app/javascript/mastodon/locales/whitelist_br.json
  24. 2
      app/javascript/mastodon/locales/whitelist_bs.json
  25. 2
      app/javascript/mastodon/locales/whitelist_ca.json
  26. 2
      app/javascript/mastodon/locales/whitelist_ckb.json
  27. 2
      app/javascript/mastodon/locales/whitelist_co.json
  28. 2
      app/javascript/mastodon/locales/whitelist_cs.json
  29. 2
      app/javascript/mastodon/locales/whitelist_csb.json
  30. 2
      app/javascript/mastodon/locales/whitelist_cy.json
  31. 2
      app/javascript/mastodon/locales/whitelist_da.json
  32. 5
      app/javascript/mastodon/locales/whitelist_de.json
  33. 2
      app/javascript/mastodon/locales/whitelist_el.json
  34. 2
      app/javascript/mastodon/locales/whitelist_en-GB.json
  35. 2
      app/javascript/mastodon/locales/whitelist_en.json
  36. 2
      app/javascript/mastodon/locales/whitelist_eo.json
  37. 2
      app/javascript/mastodon/locales/whitelist_es-AR.json
  38. 2
      app/javascript/mastodon/locales/whitelist_es-MX.json
  39. 2
      app/javascript/mastodon/locales/whitelist_es.json
  40. 2
      app/javascript/mastodon/locales/whitelist_et.json
  41. 2
      app/javascript/mastodon/locales/whitelist_eu.json
  42. 2
      app/javascript/mastodon/locales/whitelist_fa.json
  43. 2
      app/javascript/mastodon/locales/whitelist_fi.json
  44. 2
      app/javascript/mastodon/locales/whitelist_fo.json
  45. 2
      app/javascript/mastodon/locales/whitelist_fr-QC.json
  46. 2
      app/javascript/mastodon/locales/whitelist_fr.json
  47. 2
      app/javascript/mastodon/locales/whitelist_fy.json
  48. 2
      app/javascript/mastodon/locales/whitelist_ga.json
  49. 2
      app/javascript/mastodon/locales/whitelist_gd.json
  50. 2
      app/javascript/mastodon/locales/whitelist_gl.json
  51. 2
      app/javascript/mastodon/locales/whitelist_he.json
  52. 2
      app/javascript/mastodon/locales/whitelist_hi.json
  53. 2
      app/javascript/mastodon/locales/whitelist_hr.json
  54. 2
      app/javascript/mastodon/locales/whitelist_hu.json
  55. 2
      app/javascript/mastodon/locales/whitelist_hy.json
  56. 2
      app/javascript/mastodon/locales/whitelist_id.json
  57. 2
      app/javascript/mastodon/locales/whitelist_ig.json
  58. 2
      app/javascript/mastodon/locales/whitelist_io.json
  59. 2
      app/javascript/mastodon/locales/whitelist_is.json
  60. 2
      app/javascript/mastodon/locales/whitelist_it.json
  61. 2
      app/javascript/mastodon/locales/whitelist_ja.json
  62. 2
      app/javascript/mastodon/locales/whitelist_ka.json
  63. 2
      app/javascript/mastodon/locales/whitelist_kab.json
  64. 2
      app/javascript/mastodon/locales/whitelist_kk.json
  65. 2
      app/javascript/mastodon/locales/whitelist_kn.json
  66. 2
      app/javascript/mastodon/locales/whitelist_ko.json
  67. 2
      app/javascript/mastodon/locales/whitelist_ku.json
  68. 2
      app/javascript/mastodon/locales/whitelist_kw.json
  69. 2
      app/javascript/mastodon/locales/whitelist_la.json
  70. 2
      app/javascript/mastodon/locales/whitelist_lt.json
  71. 2
      app/javascript/mastodon/locales/whitelist_lv.json
  72. 2
      app/javascript/mastodon/locales/whitelist_mk.json
  73. 2
      app/javascript/mastodon/locales/whitelist_ml.json
  74. 2
      app/javascript/mastodon/locales/whitelist_mr.json
  75. 2
      app/javascript/mastodon/locales/whitelist_ms.json
  76. 2
      app/javascript/mastodon/locales/whitelist_my.json
  77. 2
      app/javascript/mastodon/locales/whitelist_nl.json
  78. 2
      app/javascript/mastodon/locales/whitelist_nn.json
  79. 2
      app/javascript/mastodon/locales/whitelist_no.json
  80. 2
      app/javascript/mastodon/locales/whitelist_oc.json
  81. 2
      app/javascript/mastodon/locales/whitelist_pa.json
  82. 2
      app/javascript/mastodon/locales/whitelist_pl.json
  83. 2
      app/javascript/mastodon/locales/whitelist_pt-BR.json
  84. 2
      app/javascript/mastodon/locales/whitelist_pt-PT.json
  85. 2
      app/javascript/mastodon/locales/whitelist_ro.json
  86. 2
      app/javascript/mastodon/locales/whitelist_ru.json
  87. 2
      app/javascript/mastodon/locales/whitelist_sa.json
  88. 2
      app/javascript/mastodon/locales/whitelist_sc.json
  89. 2
      app/javascript/mastodon/locales/whitelist_sco.json
  90. 2
      app/javascript/mastodon/locales/whitelist_si.json
  91. 2
      app/javascript/mastodon/locales/whitelist_sk.json
  92. 2
      app/javascript/mastodon/locales/whitelist_sl.json
  93. 2
      app/javascript/mastodon/locales/whitelist_sq.json
  94. 2
      app/javascript/mastodon/locales/whitelist_sr-Latn.json
  95. 2
      app/javascript/mastodon/locales/whitelist_sr.json
  96. 2
      app/javascript/mastodon/locales/whitelist_sv.json
  97. 2
      app/javascript/mastodon/locales/whitelist_szl.json
  98. 2
      app/javascript/mastodon/locales/whitelist_ta.json
  99. 2
      app/javascript/mastodon/locales/whitelist_tai.json
  100. 2
      app/javascript/mastodon/locales/whitelist_te.json
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -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

@ -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);
}

@ -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';

@ -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);

@ -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);

@ -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);
}

@ -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>
);

@ -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>

@ -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>

@ -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');

@ -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>

@ -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>

@ -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

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

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

Loading…
Cancel
Save