mirror of
https://github.com/CompeyDev/fxtwitter-docker.git
synced 2025-04-10 21:10:54 +01:00
localize photo/video counters
This commit is contained in:
parent
114d441b6b
commit
cb1c912237
4 changed files with 10 additions and 4 deletions
|
@ -5,6 +5,10 @@
|
||||||
"quotedFrom": "Quoting {name} (@{screen_name})",
|
"quotedFrom": "Quoting {name} (@{screen_name})",
|
||||||
"replyingTo": "Replying to @{screen_name}",
|
"replyingTo": "Replying to @{screen_name}",
|
||||||
"threadPartHeader": "A part of @${status.author.screen_name}'s thread",
|
"threadPartHeader": "A part of @${status.author.screen_name}'s thread",
|
||||||
|
|
||||||
|
"photoCount": "Photo {number} / {total}",
|
||||||
|
"videoCount": "Video {number} / {total}",
|
||||||
|
"mediaCount": "Media {number} / {total}",
|
||||||
|
|
||||||
"videoAltTextUnavailable": "{author}'s video. Alt text not available.",
|
"videoAltTextUnavailable": "{author}'s video. Alt text not available.",
|
||||||
"gifAltTextUnavailable": "{author}'s GIF. Alt text not available.",
|
"gifAltTextUnavailable": "{author}'s GIF. Alt text not available.",
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Strings } from '../strings';
|
import i18next from 'i18next';
|
||||||
|
|
||||||
/* Helper for Quote Tweets */
|
/* Helper for Quote Tweets */
|
||||||
export const handleQuote = (quote: APIStatus): string | null => {
|
export const handleQuote = (quote: APIStatus): string | null => {
|
||||||
console.log('Quoting status ', quote.id);
|
console.log('Quoting status ', quote.id);
|
||||||
|
|
||||||
let str = `\n`;
|
let str = `\n`;
|
||||||
str += Strings.QUOTE_TEXT.format({
|
str += i18next.t('quotedFrom').format({
|
||||||
name: quote.author?.name || '',
|
name: quote.author?.name || '',
|
||||||
screen_name: quote.author?.screen_name || ''
|
screen_name: quote.author?.screen_name || ''
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import i18next from 'i18next';
|
||||||
import { Constants } from '../constants';
|
import { Constants } from '../constants';
|
||||||
import { Strings } from '../strings';
|
import { Strings } from '../strings';
|
||||||
|
|
||||||
|
@ -13,7 +14,7 @@ export const renderPhoto = (
|
||||||
|
|
||||||
const all = status.media?.all as APIMedia[];
|
const all = status.media?.all as APIMedia[];
|
||||||
const baseString =
|
const baseString =
|
||||||
all.length === status.media?.photos?.length ? Strings.PHOTO_COUNT : Strings.MEDIA_COUNT;
|
all.length === status.media?.photos?.length ? i18next.t('photoCount') : i18next.t('mediaCount');
|
||||||
|
|
||||||
const photoCounter = baseString.format({
|
const photoCounter = baseString.format({
|
||||||
number: String(all.indexOf(photo) + 1),
|
number: String(all.indexOf(photo) + 1),
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import i18next from 'i18next';
|
||||||
import { Constants } from '../constants';
|
import { Constants } from '../constants';
|
||||||
import { Experiment, experimentCheck } from '../experiments';
|
import { Experiment, experimentCheck } from '../experiments';
|
||||||
import { handleQuote } from '../helpers/quote';
|
import { handleQuote } from '../helpers/quote';
|
||||||
|
@ -33,7 +34,7 @@ export const renderVideo = (
|
||||||
we'll put an indicator if there are more than one video */
|
we'll put an indicator if there are more than one video */
|
||||||
if (all && all.length > 1 && (userAgent?.indexOf('Telegram') ?? 0) > -1) {
|
if (all && all.length > 1 && (userAgent?.indexOf('Telegram') ?? 0) > -1) {
|
||||||
const baseString =
|
const baseString =
|
||||||
all.length === status.media?.videos?.length ? Strings.VIDEO_COUNT : Strings.MEDIA_COUNT;
|
all.length === status.media?.videos?.length ? i18next.t('videoCount') : i18next.t('mediaCount');
|
||||||
const videoCounter = baseString.format({
|
const videoCounter = baseString.format({
|
||||||
number: String(all.indexOf(video) + 1),
|
number: String(all.indexOf(video) + 1),
|
||||||
total: String(all.length)
|
total: String(all.length)
|
||||||
|
|
Loading…
Add table
Reference in a new issue