Skip to content

Commit

Permalink
Add localization for dictionary settings
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-dudarev committed Oct 17, 2023
1 parent 8f29344 commit 1af187c
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 39 deletions.
7 changes: 4 additions & 3 deletions src/VirtoCommerce.CoreModule.Core/ModuleConstants.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using VirtoCommerce.Platform.Core.Settings;
Expand Down Expand Up @@ -41,6 +42,7 @@ public static class General
ValueType = SettingValueType.ShortText,
DefaultValue = "gram",
IsDictionary = true,
IsLocalizable = true,
AllowedValues = new[] { "gram", "ounce", "pound" }
};

Expand All @@ -51,9 +53,11 @@ public static class General
ValueType = SettingValueType.ShortText,
DefaultValue = "mm",
IsDictionary = true,
IsLocalizable = true,
AllowedValues = new[] { "m", "mm", "ft", "in" }
};

[Obsolete("Use PlatformConstants.Settings.General.Languages", DiagnosticId = "VC0005", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions/")]
public static SettingDescriptor Languages = new SettingDescriptor
{
Name = "VirtoCommerce.Core.General.Languages",
Expand All @@ -79,7 +83,6 @@ public static IEnumerable<SettingDescriptor> AllSettings
yield return TaxTypes;
yield return WeightUnits;
yield return MeasureUnits;
yield return Languages;
yield return FixedTaxRateProviderRate;
}
}
Expand All @@ -94,6 +97,4 @@ public static IEnumerable<SettingDescriptor> AllSettings
}
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="TimeZoneConverter" Version="3.2.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.400.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.427.0-alpha.12767-pt-13441" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Serialize.Linq" Version="1.8.1" />
<PackageReference Include="VirtoCommerce.Platform.Data" Version="3.400.0" />
<PackageReference Include="VirtoCommerce.Platform.Data" Version="3.427.0-alpha.12767-pt-13441" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VirtoCommerce.CoreModule.Core\VirtoCommerce.CoreModule.Core.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,6 @@
"description": "Available measurement units for size of physical goods",
"title": "Size measurement units"
},
"VirtoCommerce.Core.General.Languages": {
"description": "List of available languages",
"title": "Languages"
},
"VirtoCommerce.Core.FixedRateShippingMethod.Ground.Rate": {
"description": "Fixed land shipping fee",
"title": "Land shipping fee"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,6 @@
"description": "Единицы размера доступные для товаров",
"title": "Единицы размера"
},
"VirtoCommerce.Core.General.Languages": {
"description": "Список доступных языков",
"title": "Языки"
},
"VirtoCommerce.Core.FixedRateShippingMethod.Ground.Rate": {
"description": "Фиксированная стоимость за наземную доставку",
"title": "Стоимость за наземную доставку"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ angular.module('virtoCommerce.coreModule.packageType')

function initializeBlade(data) {
if (blade.isNew) data = { };
$scope.measureUnits = settings.getValues({ id: 'VirtoCommerce.Core.General.MeasureUnits' });

blade.currentEntity = angular.copy(data);
blade.origEntity = data;
Expand All @@ -39,18 +38,6 @@ angular.module('virtoCommerce.coreModule.packageType')
blade.subtitle = blade.isNew ? 'core.blades.package-type-detail.new-subtitle' : 'core.blades.package-type-detail.subtitle';
};

$scope.openMeasureUnitsDictionarySettingManagement = function (setting) {
var newBlade = {
id: 'settingDetailChild',
currentEntityId: 'VirtoCommerce.Core.General.MeasureUnits',
parentRefresh: function (data) { $scope.measureUnits = data; },
isApiSave: true,
controller: 'platformWebApp.settingDictionaryController',
template: '$(Platform)/Scripts/app/settings/blades/setting-dictionary.tpl.html'
};
bladeNavigationService.showBlade(newBlade, blade);
};

var formScope;
$scope.setForm = function (form) {
formScope = form;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@
<div class="list-descr">{{ 'core.blades.package-type-detail.labels.name-description' | translate}}</div>
</div>
<div class="form-group">
<label class="form-label">{{ 'core.blades.package-type-detail.labels.measureUnit' | translate }}<a href="" ng-click="openMeasureUnitsDictionarySettingManagement()" class="form-edit" va-permission="platform:setting:update"><i class="form-ico fa fa-pencil"></i></a></label>
<div class="form-input">
<ui-select required ng-model="blade.currentEntity.measureUnit">
<ui-select-match allow-clear="true" placeholder="N/A">{{$select.selected}}</ui-select-match>
<ui-select-choices repeat="x in measureUnits | filter: $select.search">
<span ng-bind-html="x | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
</div>
<div class="list-descr">{{ 'core.blades.package-type-detail.labels.measureUnit-description' | translate}}</div>
<va-setting-value-select blade="blade"
label="'core.blades.package-type-detail.labels.measureUnit' | translate"
description="'core.blades.package-type-detail.labels.measureUnit-description' | translate"
placeholder="'N/A'"
setting="'VirtoCommerce.Core.General.MeasureUnits'"
ng-model="blade.currentEntity.measureUnit"
required
allow-clear></va-setting-value-select>
</div>
<div class="form-group">
<label class="form-label">{{ 'core.blades.package-type-detail.labels.height' | translate}}</label>
Expand Down
6 changes: 3 additions & 3 deletions src/VirtoCommerce.CoreModule.Web/module.manifest
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<id>VirtoCommerce.Core</id>
<version>3.401.0</version>
<version-tag />
<platformVersion>3.400.0</platformVersion>
<platformVersion>3.427.0-alpha.12767-pt-13441</platformVersion>
<title>Commerce core module</title>
<description>Common e-commerce domain functionality</description>
<authors>
Expand All @@ -26,4 +26,4 @@
<group>commerce</group>
</groups>
<useFullTypeNameInSwagger>false</useFullTypeNameInSwagger>
</module>
</module>

0 comments on commit 1af187c

Please sign in to comment.