Skip to content

Commit

Permalink
Reuse server strings when possible in stats
Browse files Browse the repository at this point in the history
We were making people translate stuff twice a lot more than strictly
needed, and mwiencek suggested we don't. I'm sure I've missed some
reused strings, but this is most of them.

To ensure we don't accidentally use l for statistics strings,
this explicitly imports l as lMbServer and uses that.
We have a test to prevent bare l(), but it doesn't seem to work
at the moment since it wasn't triggered by this.
  • Loading branch information
reosarevok committed Jan 16, 2025
1 parent abfd718 commit 71f4c0b
Show file tree
Hide file tree
Showing 9 changed files with 157 additions and 144 deletions.
13 changes: 7 additions & 6 deletions root/statistics/Countries.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import * as React from 'react';
import {CatalystContext} from '../context.mjs';
import manifest from '../static/manifest.mjs';
import EntityLink from '../static/scripts/common/components/EntityLink.js';
import {l as lMbServer} from '../static/scripts/common/i18n.js';
import loopParity from '../utility/loopParity.js';

import StatisticsLayout from './StatisticsLayout.js';
Expand Down Expand Up @@ -47,27 +48,27 @@ component Countries(
<tr>
<th className="pos">{l_statistics('Rank')}</th>
<th>
{l_statistics('Country')}
{lMbServer('Country')}
<div className="arrow" />
</th>
<th>
{l_statistics('Artists')}
{lMbServer('Artists')}
<div className="arrow" />
</th>
<th>
{l_statistics('Releases')}
{lMbServer('Releases')}
<div className="arrow" />
</th>
<th>
{l_statistics('Labels')}
{lMbServer('Labels')}
<div className="arrow" />
</th>
<th>
{l_statistics('Events')}
{lMbServer('Events')}
<div className="arrow" />
</th>
<th>
{l_statistics('Places')}
{lMbServer('Places')}
<div className="arrow" />
</th>
<th>
Expand Down
7 changes: 4 additions & 3 deletions root/statistics/Editors.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as React from 'react';

import {CatalystContext} from '../context.mjs';
import EditorLink from '../static/scripts/common/components/EditorLink.js';
import {l as lMbServer} from '../static/scripts/common/i18n.js';
import loopParity from '../utility/loopParity.js';

import StatisticsLayout from './StatisticsLayout.js';
Expand Down Expand Up @@ -85,7 +86,7 @@ component Editors(
<StatisticsLayout
fullWidth
page="editors"
title={l_statistics('Editors')}
title={lMbServer('Editors')}
>
<p>
{texp.l_statistics('Last updated: {date}', {date: dateCollected})}
Expand All @@ -101,13 +102,13 @@ component Editors(
<EditorStatsTable
countLabel={l_statistics('Open and applied edits in past week')}
dataPoints={topRecentlyActiveEditors}
editorLabel={l_statistics('Editor')}
editorLabel={lMbServer('Editor')}
tableLabel={l_statistics('Most active editors in the past week')}
/>
<EditorStatsTable
countLabel={l_statistics('Total applied edits')}
dataPoints={topEditors}
editorLabel={l_statistics('Editor')}
editorLabel={lMbServer('Editor')}
tableLabel={l_statistics('Top editors overall')}
/>
</div>
Expand Down
3 changes: 2 additions & 1 deletion root/statistics/Edits.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as React from 'react';

import LinkSearchableEditType from '../components/LinkSearchableEditType.js';
import {CatalystContext} from '../context.mjs';
import {l as lMbServer} from '../static/scripts/common/i18n.js';

import StatisticsLayout from './StatisticsLayout.js';
import {formatCount, formatPercentage, TimelineLink} from './utilities.js';
Expand All @@ -31,7 +32,7 @@ component Edits(
<p>
{texp.l_statistics('Last updated: {date}', {date: dateCollected})}
</p>
<h2>{l_statistics('Edits')}</h2>
<h2>{lMbServer('Edits')}</h2>
{Object.keys(statsByCategory).length === 0 ? (
<p>
{l_statistics('No edit statistics available.')}
Expand Down
7 changes: 4 additions & 3 deletions root/statistics/Formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as React from 'react';

import LinkSearchableProperty from '../components/LinkSearchableProperty.js';
import {CatalystContext} from '../context.mjs';
import {l as lMbServer} from '../static/scripts/common/i18n.js';
import loopParity from '../utility/loopParity.js';

import StatisticsLayout from './StatisticsLayout.js';
Expand Down Expand Up @@ -46,10 +47,10 @@ component Formats(
<thead>
<tr>
<th className="pos">{l_statistics('Rank')}</th>
<th>{l_statistics('Format')}</th>
<th>{l_statistics('Releases')}</th>
<th>{lMbServer('Format')}</th>
<th>{lMbServer('Releases')}</th>
<th>{l_statistics('% of total releases')}</th>
<th>{l_statistics('Mediums')}</th>
<th>{lMbServer('Mediums')}</th>
<th>{l_statistics('% of total mediums')}</th>
</tr>
</thead>
Expand Down
Loading

0 comments on commit 71f4c0b

Please sign in to comment.