当前位置: 首页 > news >正文

如何登陆工商局网站做变更百度seo优化包含哪几项

如何登陆工商局网站做变更,百度seo优化包含哪几项,电商网页精品欣赏网站,煤炭建设协会官方网站一、demo 1、资源文件准备 如我需要对menu、logMsg内容做国际化。 resources下放各个语言文件,直接放resources下都行。我是新建了一个myi18n文件夹, (1)然后在myi18n上点击New--Resource Bundle (2)在…

一、demo

1、资源文件准备

如我需要对menu、logMsg内容做国际化。

resources下放各个语言文件,直接放resources下都行。我是新建了一个myi18n文件夹,

(1)然后在myi18n上点击New--Resource Bundle

(2)在弹框中输入base name:

(3)点击+号添加多个区域,这里以添加zh和en为例

最后点击OK,可以看到自动生成了几个文件

(4)自定义内容:

① menu.properties:

menu.user=user
menu.role=role

②  menu_en_US.properties:

menu.user=user
menu.role=role

③  menu_zh_CN.properties:

menu.user=\u7528\u6237
menu.role=\u89d2\u8272

(5)同样的方法生成logMsg:

action.add=Add
action.delete=Delete
action.update=Update
action.enable=Enable
action.disable=Disable

  logMsg_zh_CN.properties:

#Unicode
action.add=æ·»å 
action.delete=å é¤
action.update=æ´æ°
action.enable=å¯ç¨
action.disable=ç¦ç¨
2、资源文件引入

需要引入才能生效,两种方法

(1)配置文件法

在application.properties文件中配置(如我选择了这种方法)

spring.messages.basename=myi18n/menu,myi18n/logMsg
spring.messages.encoding=UTF-8
(2)代码引入

或者新建配置文件,

    ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();messageSource.setBasenames("myi18n/menu");messageSource.setDefaultEncoding("UTF-8");
3、util编写
package org.example.util;import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;import java.util.Locale;@Slf4j
@Component
public class I18nUtil {@Autowiredprivate MessageSource messageSource;public String getMessage(String key,Locale local,String... params) {if(local == null){//local = Locale.getDefault();local = LocaleContextHolder.getLocale();}String msg = messageSource.getMessage(key,null,local);log.info("msg={}",msg);return msg;}
}
4、单元测试
package com.test;import lombok.extern.slf4j.Slf4j;
import org.example.I18nApplication;
import org.example.util.I18nUtil;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.MessageSource;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.test.context.junit4.SpringRunner;import java.util.Locale;@SpringBootTest(classes = {I18nApplication.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@RunWith(SpringRunner.class)
@Slf4j
public class Test {@Autowiredprivate I18nUtil i18nUtil;@org.junit.Testpublic void test() {//logMsgString logMsgKey = "action.delete";//menuString menuKey = "menu.user";//Locale local = Locale.CHINA;String msg = i18nUtil.getMessage(menuKey,local);System.out.println(msg);}
}
5、测试
5.1、menu
 Locale local = Locale.CHINA;String msg = i18nUtil.getMessage(menuKey,local);

执行输出中文:用户

如果改成

Locale local = Locale.ENGLISH;

执行输出英文:user

5.2、logMsg
Locale local = Locale.ENGLISH;String msg = i18nUtil.getMessage(logMsgKey,local);

执行输出英文:delete

改成

Locale local = Locale.CHINA;String msg = i18nUtil.getMessage(logMsgKey,local);

执行输出:删除

5.3、默认Local

如我没有配置CANADA,

Locale local = Locale.CANADA;
String msg = i18nUtil.getMessage(logMsgKey,local);

执行输出英文:Delete。

5.4、{baseName}.properties

http://www.15wanjia.com/news/2639.html

相关文章:

  • 蓝彩网络科技_齐齐哈尔微信营销_齐齐哈尔网站建设优化大师是什么软件
  • 南京宜电的网站谁做的电商是做什么的
  • 如何做app推广seo在哪可以学
  • 大冶建设局网站百度网站关键词排名助手
  • 宁波做百度网站推广软件一键发送
  • 长沙口碑好的做网站公司哪家好友情链接工具
  • 网络维护网站百度网站优化软件
  • 贵阳网站建设公司哪个好线上推广
  • 装修网站开发前的准备工作北京网站建设
  • 深圳市龙岗区住房和建设局网站信息流广告推广
  • 网站建设项目实训报告sem推广和seo的区别
  • wordpress+支持+手机版优化设计高中
  • 合肥网站开发公司电话google官网浏览器
  • 北京企业官网网站建设报价太原网站排名推广
  • 一帘幽梦紫菱做的网站营销型网站建设费用
  • wordpress wp query太原百度关键词优化
  • 做拉皮条网站营销必备十大软件
  • 软件开发设计制作网站下载电商运营工资一般多少钱一个月
  • 仿动态网站搜索引擎营销简称
  • 平面设计软件网站做网站建设公司
  • 3d房子模型设计软件seo具体怎么优化
  • 哈尔滨做网站的价格seo网站运营
  • 减肥网站源码免费广告网
  • sql做网站后台免费的行情软件app网站
  • app模板网站百度关键词排名优化
  • 网站怎么做定时任务做网络推广可以通过哪些渠道推广
  • 做网站的销售怎么样网站建设情况
  • 苏宁易购如何进行网站的建设和维护营销型网站制作建设
  • 5年网站续费多少钱建站为应用技术
  • ps和dw做网站百度快照是什么