feat(translations): first half of 7.0 translation support

This commit is contained in:
David Ralph
2022-06-03 21:18:47 +01:00
parent cd9eed0c81
commit 109918a2c6
12 changed files with 108 additions and 41 deletions

View File

@@ -49,9 +49,19 @@ export default class ErrorBoundary extends PureComponent {
</span>
<div className="buttonsRow">
{this.state.showReport ? (
<button onClick={() => this.reportError()}>Send Error Report</button>
<button onClick={() => this.reportError()}>
{variables.language.getMessage(
variables.languagecode,
'modals.main.error_boundary.report_error',
)}
</button>
) : (
<span className="subtitle">Sent!</span>
<span className="subtitle">
{variables.language.getMessage(
variables.languagecode,
'modals.main.error_boundary.sent',
)}
</span>
)}
<button className="refresh" onClick={() => window.location.reload()}>
{variables.language.getMessage(

View File

@@ -25,7 +25,7 @@ export default class FileUpload extends PureComponent {
const settingsSize = new TextEncoder().encode(JSON.stringify(settings)).length;
if (videoCheck(file) === true) {
if (settingsSize + file.size > 4850000) {
return toast('Not enough storage!');
return toast(this.getMessage('toasts.no_storage'));
}
return this.props.loadFunction(file);
@@ -34,7 +34,7 @@ export default class FileUpload extends PureComponent {
// todo: change number
compressAccurately(file, 200).then(async (res) => {
if (settingsSize + res.size > 4850000) {
return toast('Not enough storage!');
return toast(this.getMessage('toasts.no_storage'));
}
this.props.loadFunction({

View File

@@ -38,7 +38,7 @@ export default class Header extends PureComponent {
)
}
>
<MdHelpOutline /> More Info
<MdHelpOutline /> {getMessage('modals.main.settings.sections.header.more_info')}
</span>
<span
className="link"
@@ -49,13 +49,13 @@ export default class Header extends PureComponent {
)
}
>
<MdFlag /> Report Issue
<MdFlag /> {getMessage('modals.main.settings.sections.header.report_issue')}
</span>
</div>
{this.props.switch ? (
<SettingsItem
title={getMessage('modals.main.settings.enabled')}
subtitle="Choose whether or not to show this widget"
subtitle={getMessage('modals.main.settings.sections.header.enabled')}
>
<Switch
name={this.props.setting}
@@ -69,7 +69,7 @@ export default class Header extends PureComponent {
{this.props.zoomSetting ? (
<SettingsItem
title={getMessage('modals.main.settings.sections.appearance.accessibility.widget_zoom')}
subtitle="Slider to control how large the widget is"
subtitle={getMessage('modals.main.settings.sections.header.size')}
>
<Slider
name={this.props.zoomSetting}

View File

@@ -19,7 +19,12 @@ export default function ResetModal({ modalClose }) {
'modals.main.settings.sections.advanced.reset_modal.title',
)}
</span>
<Tooltip title="Close">
<Tooltip
title={variables.language.getMessage(
variables.languagecode,
'modals.main.settings.sections.advanced.reset_modal.cancel',
)}
>
<div className="close" onClick={modalClose}>
<MdClose />
</div>
@@ -40,11 +45,17 @@ export default function ResetModal({ modalClose }) {
<div className="resetFooter">
<button className="textButton" onClick={modalClose}>
<MdClose />
Close
{variables.language.getMessage(
variables.languagecode,
'modals.main.settings.sections.advanced.reset_modal.cancel',
)}
</button>
<button onClick={() => reset()}>
<MdRestartAlt />
Reset
{variables.language.getMessage(
variables.languagecode,
'modals.main.settings.buttons.reset',
)}
</button>
</div>
</div>

View File

@@ -89,21 +89,37 @@ export default class Tabs extends PureComponent {
onClick={() => this.props.changeTab('settings')}
>
<MdSettings />
<span>Settings</span>
<span>
{' '}
{variables.language.getMessage(
variables.languagecode,
'modals.main.navbar.settings',
)}
</span>
</button>
<button
className={'navbar-item' + addonsActive}
onClick={() => this.props.changeTab('addons')}
>
<MdOutlineExtension />
<span>Add-ons</span>
<span>
{variables.language.getMessage(
variables.languagecode,
'modals.main.navbar.addons',
)}
</span>
</button>
<button
className={'navbar-item' + marketplaceActive}
onClick={() => this.props.changeTab('marketplace')}
>
<MdOutlineShoppingBasket />
<span>Marketplace</span>
<span>
{variables.language.getMessage(
variables.languagecode,
'modals.main.navbar.marketplace',
)}
</span>
</button>
</div>
{this.props.children.map((tab) => {

View File

@@ -35,13 +35,16 @@ const downloadImage = async (info) => {
variables.stats.postEvent('feature', 'Background download');
};
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
export default function PhotoInformation({ info, url, api }) {
const [width, setWidth] = useState(0);
const [height, setHeight] = useState(0);
const [usePhotoMap, setPhotoMap] = useState(false);
const [setMapIcon] = useState(true);
const [showExtraInfo, setshowExtraInfo] = useState(false);
const [showOld, setShowOld] = useState(true);
//const [showOld, setShowOld] = useState(true);
const [other, setOther] = useState(false);
const [shareModal, openShareModal] = useState(false);
@@ -268,13 +271,13 @@ export default function PhotoInformation({ info, url, api }) {
{showExtraInfo || other ? (
<>
<div className="concept-buttons">
<Tooltip title="Share" key="share">
<Tooltip title={getMessage('widgets.quote.share')} key="share">
<Share onClick={() => openShareModal(true)} />
</Tooltip>
<Tooltip title="Favourite" key="favourite">
<Tooltip title={getMessage('widgets.quote.favourite')} key="favourite">
<Favourite />
</Tooltip>
<Tooltip title="Download" key="download">
<Tooltip title={getMessage('widgets.background.download')} key="download">
<Download onClick={() => downloadImage(info)} />
</Tooltip>
</div>

View File

@@ -144,15 +144,15 @@ class Todo extends PureComponent {
<div className="flexTodo">
<div className="topBarNotes" style={{ display: 'flex' }}>
<MdChecklist />
<span>Todo</span>
<span>{variables.language.getMessage(variables.languagecode, 'widgets.navbar.todo.title')}</span>
</div>
<div className="notes-buttons">
<Tooltip title="Pin">
<Tooltip title={variables.language.getMessage(variables.languagecode, 'widgets.navbar.todo.pin')}>
<button onClick={() => this.pin()}>
<MdPushPin />
</button>
</Tooltip>
<Tooltip title={'Add'}>
<Tooltip title={variables.language.getMessage(variables.languagecode, 'widgets.navbar.todo.add')}>
<button onClick={() => this.updateTodo('add')}>
<MdPlaylistAdd />
</button>

View File

@@ -22,33 +22,34 @@ import Interval from 'modules/helpers/interval';
import EventBus from 'modules/helpers/eventbus';
import './quote.scss';
import { getInitColorSchemeScript } from '@mui/material';
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
export default class Quote extends PureComponent {
buttons = {
share: (
<Tooltip title="Share">
<Tooltip title={getMessage('widgets.quote.share')}>
<button onClick={() => this.setState({ shareModal: true })}>
<MdIosShare className="copyButton" />
</button>
</Tooltip>
),
copy: (
<Tooltip title="Copy">
<Tooltip title={getMessage('widgets.quote.copy')}>
<button onClick={() => this.copyQuote()}>
<MdContentCopy className="copyButton" />
</button>
</Tooltip>
),
unfavourited: (
<Tooltip title="Favourite">
<Tooltip title={getMessage('widgets.quote.favourite')}>
<button onClick={() => this.favourite()}>
<MdStarBorder className="copyButton" />
</button>
</Tooltip>
),
favourited: (
<Tooltip title="Unfavourite">
<Tooltip title={getMessage('widgets.quote.unfavourite')}>
<button onClick={() => this.favourite()}>
<MdStar className="copyButton" />
</button>
@@ -298,7 +299,7 @@ export default class Quote extends PureComponent {
copyQuote() {
variables.stats.postEvent('feature', 'Quote copied');
navigator.clipboard.writeText(`${this.state.quote} - ${this.state.author}`);
toast(variables.language.getMessage(variables.languagecode, 'toasts.quote'));
toast(getMessage('toasts.quote'));
}
tweetQuote() {
@@ -461,13 +462,14 @@ export default class Quote extends PureComponent {
</div>
) : (
<div className="author-content whileLoading" ref={this.quoteauthor}>
{/* these are placeholders for skeleton and as such don't need translating */}
<span className="title">loading</span>
<span className="subtitle">loading</span>
</div>
)}
<div className="quote-buttons">
{this.state.authorOccupation !== 'Unknown' && this.state.authorlink !== '' ? (
<Tooltip title="Open On Wikipedia">
<Tooltip title={getMessage('widgets.quote.link_tooltip')}>
<a
href={this.state.authorlink}
className="quoteAuthorLink"

View File

@@ -214,7 +214,7 @@ export default class Weather extends PureComponent {
) : null}
*/}
{localStorage.getItem('weatherType') >= 3 && (
<span className="subtitle">Extra Information</span>
<span className="subtitle">{variables.language.getMessage(variables.languagecode, 'widgets.weather.extra_information')}</span>
)}
{enabled('cloudiness') ? (
<span>
@@ -279,7 +279,9 @@ export default class Weather extends PureComponent {
{localStorage.getItem('weatherType') >= 2 && (
<div className="extra-info">
{/*{enabled('humidity') ? <span><WiHumidity/>{this.state.weather.humidity}%</span> : null}*/}
<span>Feels like {this.state.weather.temp_feels_like + this.state.temp_text}</span>
<span>{variables.language.getMessage(variables.languagecode, 'widgets.weather.feels_like', {
amount: this.state.weather.temp_feels_like + this.state.temp_text
})}</span>
<span className="loc">{this.state.location}</span>
</div>
)}

View File

@@ -11,7 +11,7 @@ export const OPENSTREETMAP_URL = 'https://www.openstreetmap.org';
// Mue URLs
export const WEBSITE_URL = 'https://muetab.com';
export const PRIVACY_URL = 'https://muetab.com/privacy';
export const BLOG_POST = 'https://blog.muetab.com/posts/version-6-0';
export const BLOG_POST = 'https://blog.muetab.com/posts/version-7-0';
export const TRANSLATIONS_URL = 'https://docs.muetab.com/translations/';
export const REPORT_ITEM =
'https://github.com/mue/marketplace/issues/new?assignees=&labels=item+report&template=item-report.md&title=%5BItem+Report%5D+';

View File

@@ -32,7 +32,16 @@
},
"weather": {
"not_found": "Not Found",
"meters": "{amount} metres"
"meters": "{amount} metres",
"extra_information": "Extra Information",
"feels_like": "Feels like {amount}"
},
"quote": {
"link_tooltip": "Open on Wikipedia",
"share": "Share",
"copy": "Copy",
"favourite": "Favourite",
"unfavourite": "Unfavourite"
},
"navbar": {
"tooltips": {
@@ -41,6 +50,11 @@
"notes": {
"title": "Notes",
"placeholder": "Type here"
},
"todo": {
"title": "Todo",
"pin": "Pin",
"add": "Add"
}
}
},
@@ -51,12 +65,14 @@
"file_upload_error": "File is over 2MB",
"navbar": {
"settings": "Settings",
"addons": "My Add-ons",
"addons": "Add-ons",
"marketplace": "Marketplace"
},
"error_boundary": {
"title": "Error",
"message": "Failed to load this component of Mue",
"report_error": "Send Error Report",
"sent": "Sent!",
"refresh": "Refresh"
},
"settings": {
@@ -66,6 +82,12 @@
"message": "In order for all of the changes to take place, the page must be refreshed."
},
"sections": {
"header": {
"more_info": "More info",
"report_issue": "Report Issue",
"enabled": "Choose whether or not to show this widget",
"size": "Slider to control how large the widget is"
},
"time": {
"title": "Time",
"format": "Format",
@@ -550,6 +572,7 @@
"uninstalled": "Successfully removed",
"updated": "Successfully updated",
"error": "Something went wrong",
"imported": "Successfully imported"
"imported": "Successfully imported",
"no_storage": "Not enough storage"
}
}