ABP Combat--Modify language configuration XML to JSON

Source: Internet
Author: User

ABP Combat--Modify language configuration XML to JSON

tags (space delimited): Uncategorized

The zero multi-language configuration downloaded from the ABP website is using XML files by default, and XML is not as clear as JSON in actual use, so we modify it to JSON format.

-Modify the MyLocalizationConfigurer.cs file
We found the LocalizationConfigurer.cs file under Core-localization and replaced it with:

public static void Configure(ILocalizationConfiguration localizationConfiguration)        {            //获得dll的全路径            var location = Assembly.GetEntryAssembly().Location;            var sourceDir = Directory.GetParent(location) + "/Localization/SourceFiles";            localizationConfiguration.Sources.Add(                new DictionaryBasedLocalizationSource(CeciConsts.LocalizationSourceName,                    new JsonFileLocalizationDictionaryProvider(sourceDir)                )            );        }

Note that this gets the files under our run directory /Localization/SourceFiles under the file as resource.
-Modify the copy of the resource file
Under the same sourcefiles, add the corresponding JSON file with reference to the XML file name and F4 set it 复制到输出目录 as 始终复制 .
The contents of the JSON file are as follows, culture indicate the specific language, and refer to the ABP documentation in detail.

{"Culture": "en", "texts": {"homepage": "Home page", "about": ' About ', "wellcomemessage": "Welcome to ceci!" , "Formisnotvalidmessage": "Form is not valid. Please check and fix errors. "," Tenantnamecannotbeempty ":" Tenant name can is not is empty "," Invalidusernameorpassword    ":" Invalid User name or password "," thereisnotenantdefinedwithname{0} ":" There is no tenant defined with name {0} ",  "Tenantisnotactive": "Tenant {0} is not active.", "Userisnotactiveandcannotlogin": "User {0} was not active and can not Log in. "," Useremailisnotconfirmedandcannotlogin ":" Your e-mail address is not confirmed. You can not login. "," Userlockedoutmessage ":" The user account had been locked out. Please try again later. "," pleaseenterlogininformation ":" Please enter login information "," Tenancyname ":" Tenancy N Ame "," Usernameoremail ":" User name or email "," Password ":" Password "," RememberMe ":" Remember Me "," LogIn ":" Log in "," loginfailed ":" Login faileD! "," Namesurname ":" Name surname "," UserName ":" User name "," name ":" Name "," surname ":" Surname "," Emailad Dress ":" Email Address "," tenants ":" Tenants "," savedsuccessfully ":" Saved successfully "," createnewtenant ": Cre Ate new tenant "," adminemailaddress ":" Admin email Address "," Save ":" Save "," Cancel ":" Cancel "," Tenantname_r Egex_description ":" Tenant name must be at least 2 chars, starts with a letter and continue with letter, number, dash or U Nderscore. "," Defaultpasswordis ":" Default password is {0} "," Canbeemptytologinashost ":" Can being empty to login as Ho St. "," register ":" register "," Orloginwith ":" Or Login with "," Waitingforactivationmessage ":" Your account is Wai Ting to being activated by the system admin. "," tenantselection ":" Tenant Selection "," Tenantselection_detail ":" Please sel  ECT one of the following tenants. "," Logout ":" Logout "," registerformusernameinvalidmessage ":" Please don ' t enter an Email address for UsernAme. "," databaseconnectionstring ":" Database Connection string "," Users ":" Users "," IsActive ":" Is active "," F    Ullname ":" Full Name "," CreateNewUser ":" Create New User "," Yes ":" Yes "," no ":" No "," Optional ":" Optional ",  "Leaveemptytoswitchtohost": "Leave empty to switch to the host", "Currenttenant": "Current Tenant", "notselected": ' Not selected ', ' Change ': ' Change ', ' changetenant ': ' Change tenant ', ' multilevelmenu ': ' Multi level menu ', ' B Ack ":" Back "," successfullyregistered ":" Successfully registered "," waitingforemailactivation ":" Your email address    Should be activated "," Roles ":" Roles "," DisplayName ":" Display Name "," Edit ":" Edit "," delete ":" Delete ", "Createnewrole": "Create New Role", "RoleName": "Role Name", "actions": "Actions", "couldnotcompleteloginoperatio N ":" Could not complete login operation. Please try again later. "," Couldnotvalidateexternaluser ":" Could not validate external user "," EditRole ":" Edit Role "," Edittenant ":" Edit Tenant "," Edituser ":" Edit User "," tenantidisnotactive{0} ":" TenantId {0} Is isn't active "," unknowntenantid{0} ":" Unknown tenantId {0} "," thisfieldisrequired ":" This field is required ","  Pleasewait ":" Please wait ... "," Administration ":" Administration "," ClearAll ":" Clear All "," clearothers ":" Clear    Others "," labeloptions ":" Label Options "," Permissions ":" Permissions "," roledescription ":" Role description ", "Refresh": "Refresh", "Create": "Create", "Userdetails": "User Details", "Userroles": "User Roles", "Confirm Password ":" Confirm Password "," Version ":" Version "," On ":" On "," Off ":" Off "," Areyousurewanttodelete ":" Is You sure want to delete {0}? "," starttyping ":" Start Typing "," Skins ":" Skins "," Settings ":" Settings "}}

ABP Combat--Modify language configuration XML to JSON

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.