mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-17 07:49:45 +02:00
parent
d3e6d7cd05
commit
cc63c3f3cd
@ -166,7 +166,7 @@ function EditMoviesModalContent(props: EditMoviesModalContentProps) {
|
|||||||
|
|
||||||
<ModalFooter className={styles.modalFooter}>
|
<ModalFooter className={styles.modalFooter}>
|
||||||
<div className={styles.selected}>
|
<div className={styles.selected}>
|
||||||
{translate('MoviesSelectedInterp', selectedCount.toString())}
|
{translate('MoviesSelectedInterp', [selectedCount])}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
@ -181,7 +181,7 @@ function MovieIndexSelectFooter() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.selected}>
|
<div className={styles.selected}>
|
||||||
{translate('MoviesSelectedInterp', selectedCount.toString())}
|
{translate('MoviesSelectedInterp', [selectedCount])}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<EditMoviesModal
|
<EditMoviesModal
|
||||||
|
@ -1,34 +1,31 @@
|
|||||||
import $ from 'jquery';
|
import createAjaxRequest from 'Utilities/createAjaxRequest';
|
||||||
|
|
||||||
function getTranslations() {
|
function getTranslations() {
|
||||||
let localization = null;
|
let localization = null;
|
||||||
const ajaxOptions = {
|
const ajaxOptions = {
|
||||||
async: false,
|
async: false,
|
||||||
type: 'GET',
|
|
||||||
global: false,
|
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
url: `${window.Radarr.apiRoot}/localization`,
|
url: '/localization',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
localization = data.Strings;
|
localization = data.Strings;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ajaxOptions.headers = ajaxOptions.headers || {};
|
createAjaxRequest(ajaxOptions);
|
||||||
ajaxOptions.headers['X-Api-Key'] = window.Radarr.apiKey;
|
|
||||||
|
|
||||||
$.ajax(ajaxOptions);
|
|
||||||
return localization;
|
return localization;
|
||||||
}
|
}
|
||||||
|
|
||||||
const translations = getTranslations();
|
const translations = getTranslations();
|
||||||
|
|
||||||
export default function translate(key, args = '') {
|
export default function translate(key, args) {
|
||||||
|
const translation = translations[key] || key;
|
||||||
|
|
||||||
if (args) {
|
if (args) {
|
||||||
const translatedKey = translate(key);
|
return translation.replace(/\{(\d+)\}/g, (match, index) => {
|
||||||
return translatedKey.replace(/\{(\d+)\}/g, (match, index) => {
|
|
||||||
return args[index];
|
return args[index];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return translations[key] || key;
|
return translation;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user