puresoft/easy-lang 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

puresoft/easy-lang

Composer 安装命令:

composer require puresoft/easy-lang

包简介

A simple PHP class for creating pages with multiple languages

README 文档

README

A simple PHP class for creating pages with multiple languages

By using this class you can use multiple languages in PHP pages. Languages are saved in a UTF-8 .ini file and will load by their language short names. This class provided with Getters and Setters, so you can easily customize it.

Installation

You can simply download or clone this project or if you want, you can install EasyLang through composer: composer require puresoft/easy-lang

Usage:

First include EasyLang file:

require_once 'easylang.php';

Then you should make a .ini file which can be found in languages folder of demo and name it as its language short name. For example we create a file with name of en.ini for English language.

Now we can make an object from EasyLang like this:

$languages_path = 'languages/'; // Don't forget '/' at the end of path

$language_short_name = 'en';

$is_rtl = false; // Some languages are in right to left direction. This will be useful if we store this property in EasyLang for later use_

$translate = new EasyLang( $languages_path, $language_short_name, $is_rtl_ );

So, EasyLang will find a file with name of en.ini in languages folder.

Inside that .ini file we have a constant and a translate like this:

MY_TITLE = "Here is my page Title"

Now we can use this constant like this:

echo $translate->getTranslate( 'MY_TITLE' );

Demo Script

There is an index.php in project that contains an example to show how to use EasyLang in your code.

统计信息

  • 总下载量: 32
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固