zoukankan      html  css  js  c++  java
  • 本地化与国际化

    Locale为本地化类

    Locale locale=Locale.getDefault();//获取当前系统默认的环境

     国际化

      1:静态数据国际化

          国际化软件:

              1:存储所有国家显示的文本的字符串

                a>文件:properties

                命名:基础名_语言简称_国家简称_properties;  例如:msg_zh_CN.properties

                    默认:基础名.properties

              2:程序中获取

                ResourceBundle国际化类

                ResourceBundle resource=ResourceBundle.getBundle("包名+基础名",locale);

                String xxx=resource.getString("key值")

      2:动态文本国际化

          本地敏感类:若jdk中的某个类在运行时需要根据Locale对象来调整其功能,这个类就成为本地敏感类

    ---------------------------------------------分割线:国际化标签jstl-------------------------------------------

    使用步骤:

    1--<fmt:setLocale value=${pageContext.request.Locale}></fmt:setLocale>

    2--<fmt:setBundle basename="包名+基础名" var="bundle"></fmt:setBundle>

    3--<fmt:message key="key值" bundle="${bundle}"></fmt:message>

     ------------------------------------------分割线:格式化金额--------------------------------------------------

      格式:0.00 保留两位小数 自动补0

         #.##保留两位小数 不自动补0   如果 pattern="#.#"  value=100.99  在页面会显示101 因为最后一位9会四舍五入  向前进一位  就是101.0 而它不是补0  所以结果为101

    <fmt:formatNumber pattern="#.##" value="100"></fmt:formatNumber>

     ------------------------------------------分割线:格式化时间--------------------------------------------------

    <fmt:formatDate pattern="yyyy-MM-dd" value="${后台获取的date(new Date())}"></fmt:formatDate>

  • 相关阅读:
    mysql把查询结果集插入到表理
    js遍历json数据
    php事务回滚
    win10定时执行php脚本
    php输出json的内容
    图像的几个基本概念
    linux系统编程之I/O内核数据结构
    linux系统编程之错误处理
    深拷贝和浅拷贝
    mysql用户的创建
  • 原文地址:https://www.cnblogs.com/ly-china/p/5426783.html
Copyright © 2011-2022 走看看