[Glitch] Fix /share and cleanup and reorganize frontend locale loading

Port b0780cfeed to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Renaud Chaput
2023-06-02 15:00:27 +02:00
committed by Claire
parent 734e186717
commit 9e66c07be7
14 changed files with 151 additions and 86 deletions

View File

@@ -1,6 +1,6 @@
// @ts-check
import { getLocale } from 'mastodon/locales';
import { getLocale } from 'flavours/glitch/locales';
import { connectStream } from '../stream';
@@ -25,8 +25,6 @@ import {
fillListTimelineGaps,
} from './timelines';
const { messages } = getLocale();
/**
* @param {number} max
* @returns {number}
@@ -44,8 +42,10 @@ const randomUpTo = max =>
* @param {function(object): boolean} [options.accept]
* @returns {function(): void}
*/
export const connectTimelineStream = (timelineId, channelName, params = {}, options = {}) =>
connectStream(channelName, params, (dispatch, getState) => {
export const connectTimelineStream = (timelineId, channelName, params = {}, options = {}) => {
const { messages } = getLocale();
return connectStream(channelName, params, (dispatch, getState) => {
const locale = getState().getIn(['meta', 'locale']);
// @ts-expect-error
@@ -122,6 +122,7 @@ export const connectTimelineStream = (timelineId, channelName, params = {}, opti
},
};
});
};
/**
* @param {Function} dispatch