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 />
<PageToolbarButton
label={translate('RssSync')}
label={translate('RSSSync')}
iconName={icons.RSS}
isSpinning={isRssSyncExecuting}
onPress={onRssSyncPress}

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,7 @@ function getTranslations() {
dataType: 'json',
url: `${window.Radarr.apiRoot}/localization`,
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[formatedKey] || key;
return translations[key] || key;
}

View File

@ -1,3 +1,4 @@
using Newtonsoft.Json;
using NzbDrone.Core.Localization;
using Radarr.Http;
@ -11,12 +12,21 @@ namespace Radarr.Api.V3.Localization
{
_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);
}
}
}