tacoberu/fluent-intl 问题修复 & 功能扩展

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

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

tacoberu/fluent-intl

最新稳定版本:v1.2.1

Composer 安装命令:

composer require tacoberu/fluent-intl

包简介

PHP implementation of Project Fluent. Localization library for expressive translations.

README 文档

README

This is a (uncomplete) PHP implementation of Project Fluent, a localization framework designed to unleash the entire expressive power of natural language translations.

Project Fluent keeps simple things simple and makes complex things possible. The syntax used for describing translations is easy to read and understand. At the same time it allows, when necessary, to represent complex concepts from natural languages like gender, plurals, conjugations, and others.

Learn the FTL syntax

FTL is a localization file format used for describing translation resources. FTL stands for Fluent Translation List.

FTL is designed to be simple to read, but at the same time allows to represent complex concepts from natural languages like gender, plurals, conjugations, and others.

hello-user = Hello, { $username }!

Read the Fluent Syntax Guide in order to learn more about the syntax. If you're a tool author you may be interested in the formal EBNF grammar.

Installation

The recommended way to install is via Composer:

    composer require tacoberu/fluent-intl

Usage

require __dir__ . '/vendor/autoload.php';

use Taco\FluentIntl\FluentTranslator;
use Taco\FluentIntl\FluentResource;

$translator = new FluentTranslator("en-US");
$translator->addResource(new FluentResource('
-brand-name = Foo 3000
welcome = Welcome, {$name}, to {-brand-name}!
greet-by-name = Hello, { $name }!
emails =
    { $unreadEmails ->
        [1] You have one unread email.
       *[other] You have { $unreadEmails } unread emails.
    }
'));

$msg = $translator->getMessage("welcome");
dump($translator->formatPattern($msg->value, ["name" => "Anna"]));
// Welcome, Anna, to Foo 3000!

$msg = $translator->getMessage("emails");
dump($translator->formatPattern($msg->value, ["unreadEmails" => 5]));
// You have 5 unread emails.

Status

Only part of the specification implemented.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-02-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固