jQuery i18n 项目教程

jQuery i18n 项目教程

jquery-i18nA jQuery plugin for doing client-side translations in javascript.项目地址:https://gitcode.com/gh_mirrors/jq/jquery-i18n

1. 项目的目录结构及介绍

jquery-i18n/
├── demo/
│   ├── index.html
│   └── ...
├── libs/
│   ├── jquery.js
│   └── ...
├── src/
│   ├── jquery.i18n.js
│   └── ...
├── test/
│   ├── test.js
│   └── ...
├── .eslintrc.json
├── .gitignore
├── .gitmodules
├── .mailmap
├── CODE_OF_CONDUCT.md
├── CREDITS
├── GPL-LICENSE
├── Gruntfile.js
├── MIT-LICENSE
├── README.md
├── package-lock.json
└── package.json
  • demo/: 包含项目的演示文件。
  • libs/: 包含项目依赖的库文件,如 jQuery。
  • src/: 包含项目的主要源代码文件。
  • test/: 包含项目的测试文件。
  • .eslintrc.json: ESLint 配置文件。
  • .gitignore: Git 忽略文件配置。
  • .gitmodules: Git 子模块配置。
  • .mailmap: 邮件映射文件。
  • CODE_OF_CONDUCT.md: 行为准则文件。
  • CREDITS: 贡献者列表。
  • GPL-LICENSE: GPL 许可证文件。
  • Gruntfile.js: Grunt 任务配置文件。
  • MIT-LICENSE: MIT 许可证文件。
  • README.md: 项目说明文件。
  • package-lock.json: npm 锁定文件。
  • package.json: npm 配置文件。

2. 项目的启动文件介绍

项目的启动文件主要是 demo/index.html,它包含了项目的演示页面。在这个文件中,你可以看到如何引入 jQuery 和 jQuery i18n 插件,并进行基本的国际化配置和使用。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jQuery i18n Demo</title>
    <script src="../libs/jquery.js"></script>
    <script src="../src/jquery.i18n.js"></script>
</head>
<body>
    <h1 data-i18n="appname-title"></h1>
    <script>
        $(document).ready(function() {
            $.i18n.load({
                'en': 'lang/en.json',
                'zh': 'lang/zh.json'
            }).done(function() {
                $('body').i18n();
            });
        });
    </script>
</body>
</html>

3. 项目的配置文件介绍

项目的配置文件主要是 package.json,它包含了项目的依赖、脚本和其他配置信息。

{
  "name": "jquery-i18n",
  "version": "1.0.0",
  "description": "jQuery based internationalization library",
  "main": "src/jquery.i18n.js",
  "scripts": {
    "test": "grunt test"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/recurser/jquery-i18n.git"
  },
  "keywords": [
    "jquery",
    "i18n",
    "internationalization"
  ],
  "author": "Your Name",
  "license": "GPL-2.0",
  "bugs": {
    "url": "https://github.com/recurser/jquery-i18n/issues"
  },
  "homepage": "https://github.com/recurser/jquery-i18n#readme",
  "devDependencies": {
    "grunt": "^1.0.4",
    "grunt-contrib-jshint": "^2.1.0",
    "grunt-contrib-qunit": "^3.1.0",
    "grunt-contrib-watch": "^1.1.0"
  }
}
  • name: 项目名称。
  • version: 项目版本。
  • description: 项目描述。
  • main: 项目入口文件。
  • **

jquery-i18nA jQuery plugin for doing client-side translations in javascript.项目地址:https://gitcode.com/gh_mirrors/jq/jquery-i18n

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

袁菲李

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值