1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-27 02:09:59 +00:00

Don't Camel Case Localization Endpoint

This commit is contained in:
Qstick 2020-09-04 23:55:35 -04:00
parent b6f2afb212
commit 579a86a708
7 changed files with 23 additions and 14 deletions

View file

@ -110,7 +110,7 @@ class CalendarPage extends Component {
<PageToolbarSeparator /> <PageToolbarSeparator />
<PageToolbarButton <PageToolbarButton
label={translate('RssSync')} label={translate('RSSSync')}
iconName={icons.RSS} iconName={icons.RSS}
isSpinning={isRssSyncExecuting} isSpinning={isRssSyncExecuting}
onPress={onRssSyncPress} onPress={onRssSyncPress}

View file

@ -369,7 +369,7 @@ class MovieIndex extends Component {
/> />
<PageToolbarButton <PageToolbarButton
label={translate('RssSync')} label={translate('RSSSync')}
iconName={icons.RSS} iconName={icons.RSS}
isSpinning={isRssSyncExecuting} isSpinning={isRssSyncExecuting}
isDisabled={hasNoMovie} isDisabled={hasNoMovie}

View file

@ -115,12 +115,12 @@ function HostSettings(props) {
advancedSettings={advancedSettings} advancedSettings={advancedSettings}
isAdvanced={true} isAdvanced={true}
> >
<FormLabel>{translate('SslCertPath')}</FormLabel> <FormLabel>{translate('SSLCertPath')}</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.TEXT} type={inputTypes.TEXT}
name="sslCertPath" name="sslCertPath"
helpText={translate('SslCertPathHelpText')} helpText={translate('SSLCertPathHelpText')}
helpTextWarning={translate('RestartRequiredHelpTextWarning')} helpTextWarning={translate('RestartRequiredHelpTextWarning')}
onChange={onInputChange} onChange={onInputChange}
{...sslCertPath} {...sslCertPath}
@ -140,7 +140,7 @@ function HostSettings(props) {
<FormInputGroup <FormInputGroup
type={inputTypes.PASSWORD} type={inputTypes.PASSWORD}
name="sslCertPassword" name="sslCertPassword"
helpText={translate('SslCertPasswordHelpText')} helpText={translate('SSLCertPasswordHelpText')}
helpTextWarning={translate('RestartRequiredHelpTextWarning')} helpTextWarning={translate('RestartRequiredHelpTextWarning')}
onChange={onInputChange} onChange={onInputChange}
{...sslCertPassword} {...sslCertPassword}

View file

@ -106,7 +106,7 @@ function IndexerOptions(props) {
advancedSettings={advancedSettings} advancedSettings={advancedSettings}
isAdvanced={true} isAdvanced={true}
> >
<FormLabel>{translate('RssSyncInterval')}</FormLabel> <FormLabel>{translate('RSSSyncInterval')}</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.NUMBER} type={inputTypes.NUMBER}
@ -115,7 +115,7 @@ function IndexerOptions(props) {
max={120} max={120}
unit="minutes" unit="minutes"
helpText={translate('HelpText')} helpText={translate('HelpText')}
helpTextWarning={translate('RssSyncIntervalHelpTextWarning')} helpTextWarning={translate('RSSSyncIntervalHelpTextWarning')}
helpLink="https://github.com/Radarr/Radarr/wiki/RSS-Sync" helpLink="https://github.com/Radarr/Radarr/wiki/RSS-Sync"
onChange={onInputChange} onChange={onInputChange}
{...settings.rssSyncInterval} {...settings.rssSyncInterval}

View file

@ -73,7 +73,7 @@ class About extends Component {
} }
<DescriptionListItem <DescriptionListItem
title={translate('DbMigration')} title={translate('DBMigration')}
data={migrationVersion} data={migrationVersion}
/> />

View file

@ -9,7 +9,7 @@ function getTranslations() {
dataType: 'json', dataType: 'json',
url: `${window.Radarr.apiRoot}/localization`, url: `${window.Radarr.apiRoot}/localization`,
success: function(data) { success: function(data) {
localization = data.strings; localization = data.Strings;
} }
}; };
@ -34,6 +34,5 @@ export default function translate(key, args = '') {
}); });
} }
const formatedKey = key.charAt(0).toLowerCase() + key.slice(1); return translations[key] || key;
return translations[formatedKey] || key;
} }

View file

@ -1,3 +1,4 @@
using Newtonsoft.Json;
using NzbDrone.Core.Localization; using NzbDrone.Core.Localization;
using Radarr.Http; using Radarr.Http;
@ -11,12 +12,21 @@ public LocalizationModule(ILocalizationService localizationService)
{ {
_localizationService = localizationService; _localizationService = localizationService;
GetResourceSingle = GetLocalizationDictionary; Get("/", x => GetLocalizationDictionary());
} }
private LocalizationResource GetLocalizationDictionary() private string GetLocalizationDictionary()
{ {
return _localizationService.GetLocalizationDictionary().ToResource(); // We don't want camel case for transation strings, create new serializer settings
var serializerSettings = new JsonSerializerSettings
{
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
NullValueHandling = NullValueHandling.Ignore,
Formatting = Formatting.Indented,
DefaultValueHandling = DefaultValueHandling.Include
};
return JsonConvert.SerializeObject(_localizationService.GetLocalizationDictionary().ToResource(), serializerSettings);
} }
} }
} }