当前位置: 首页 > 软件库 > 手机/移动开发 > >

i18nh

授权协议 MIT License
开发语言 JavaScript TypeScript
所属分类 手机/移动开发
软件类型 开源软件
地区 不详
投 递 者 方高丽
操作系统 iOS
开源组织
适用人群 未知
 软件概览

Install

Support

  • NodeJS
  • React
  • NextJS
  • Create React App 1.0
  • Create React App 2.0
  • React Native
  • PhoneGap / Cordova
  • Angular
  • Vue
  • NativeScript

NPM

npm install i18nh --save

YARN

yarn add i18nh

Use

To use it is simple just look at the steps below

import i18nh, { useT } from 'i18nh'

// Create a language object containing the 
// translations as in the example below
const languages = {
    en: {
        hello: 'Hello',
        about: 'About',
        goodMorning: 'Good Morning',
    },
    pt: {
        hello: 'Olá',
        about: 'Sobre',
        goodMorning: 'Bom Dia',
    },
}

// i18nh load the language object containing 
// the translations and also the default language argument
i18nh({
    languages, 
    defaultLanguage: 'en'
});

const [t] = useT();

console.log(t('hello')) 
// Hello
console.log(t('about')) 
// About
console.log(t('goodMorning')) 
// Good Morning

console.log(t('hello', 'pt')) 
// Olá
console.log(t('about', 'pt')) 
// Sobre
console.log(t('goodMorning', 'pt')) 
// Bom Dia
  • 前言 然后 算了, 今天一天好像心情都太平静了, 似乎是没有什么起伏啊, 呵呵呵 倒也正常???, 写下关于 i18n 吧??? 老项目, servlet + jsp, 需求是国际化处理  思路 先整理一下思路, 项目是servlet + jsp, 然后网络上面搜索了一下, 主要是使用 fmt 标签, 把页面上写死的字符串打标签, 以及js中的字符串也需要替换为标签 核心思路, 大概是如上, 然后

  • wget -r -np -erobots=off -c -nH https://mirrors.tuna.tsinghua.edu.cn/debian/dists/buster-backports/main/i18n/ -P /var/vm/mirror/debian10/mirror/mirrors.tuna.tsinghua.edu.cn/ wget -r -np -erobots=o

相关阅读

相关文章

相关问答

相关文档