Skip to content

Commit

Permalink
merge(dev): version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Jun 8, 2019
2 parents d67af60 + 53f38f7 commit a10c836
Show file tree
Hide file tree
Showing 29 changed files with 904 additions and 324 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ node_modules
.env
build/
\.php_cs\.cache
/wdes-php-i18n-l10n-*.tar
/.phpunit.result.cache
151 changes: 108 additions & 43 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,129 @@
dist: trusty

language: php

php:
- "7.1"
- "7.2"

sudo: required

env:
matrix:
- CI_TYPE=phpunit

before_script:
- ./scripts/ci/install-reporters.sh
- ./scripts/ci/install.sh

- "./scripts/ci/install-reporters.sh"
- "./scripts/ci/install.sh"
script:
- ./scripts/ci/ci-$CI_TYPE.sh

install:
# flags to pass to install
- flags="--ansi --prefer-dist --no-interaction --optimize-autoloader --no-suggest --no-progress"
# install dependencies using system provided composer binary
- composer install $flags

after_success:
- bash <(curl -s https://codecov.io/bash)
- if [ "$CI_COMPOSER" = "yes" ]; then composer install --ansi --prefer-dist --no-interaction --optimize-autoloader --no-suggest --no-progress; fi

after_script:
- ./codacy-coverage.phar clover build/logs/clover.xml
- if [ "$TRAVIS_BUILD_STAGE_NAME" = "tests" ]; then ./codacy-coverage.phar clover build/logs/clover.xml; else echo "skipped codacy"; fi

matrix:
fast_finish: true
include:
- php: "7.2"
env: CI_TYPE=phpstan

- php: "7.2"
env: CI_TYPE=phpcs
stages:
- name: lint
- name: tests

- os: osx
language: generic
jobs:
include:
- stage: tests
php: "7.1"
env:
- CI_TYPE=phpunit
- CI_COMPOSER=yes
name: "PHPUNIT - PHP 7.1"
after_success:
- bash <(curl -s https://codecov.io/bash) -cF php
- stage: tests
php: "7.2"
env: CI_TYPE=phpunit
env:
- CI_TYPE=phpunit
- CI_COMPOSER=yes
name: "PHPUNIT - PHP 7.2"
after_success:
- bash <(curl -s https://codecov.io/bash) -cF php
- stage: tests
php: "7.3"
env:
- CI_TYPE=phpunit
- CI_COMPOSER=yes
name: "PHPUNIT - PHP 7.3"
after_success:
- bash <(curl -s https://codecov.io/bash) -cF php
- stage: tests
os: osx
language: node_js
node_js: "10"
env:
- CI_TYPE=phpunit
- CI_COMPOSER=yes
name: "PHPUNIT - PHP 7.1"
addons:
homebrew:
packages:
- php@7.1
- composer
before_install:
- ./scripts/ci/install-osx.sh
- mkdir ~/.homebrew_logs
- export HOMEBREW_LOGS="~/.homebrew_logs"
- export HOMEBREW_TEMP="/tmp"
- export HOMEBREW_INSTALL_BADGE="🌻"
after_success:
- bash <(curl -s https://codecov.io/bash) -cF php
- stage: tests
os: osx
language: node_js
node_js: "10"
env:
- CI_TYPE=phpunit
- CI_COMPOSER=yes
name: "PHPUNIT - PHP 7.2"
addons:
homebrew:
packages:
- php@7.2
- composer
before_install:
- mkdir ~/.homebrew_logs
- export HOMEBREW_LOGS="~/.homebrew_logs"
- export HOMEBREW_TEMP="/tmp"
- export HOMEBREW_INSTALL_BADGE="🌻"
after_success:
- bash <(curl -s https://codecov.io/bash) -cF php
- stage: tests
os: osx
language: node_js
node_js: "10"
env:
- CI_TYPE=phpunit
- CI_COMPOSER=yes
name: "PHPUNIT - PHP 7.3"
addons:
homebrew:
packages:
- php@7.3
- composer
before_install:
- mkdir ~/.homebrew_logs
- export HOMEBREW_LOGS="~/.homebrew_logs"
- export HOMEBREW_TEMP="/tmp"
- export HOMEBREW_INSTALL_BADGE="🌻"
after_success:
- bash <(curl -s https://codecov.io/bash) -cF php
- stage: lint
php: "7.3"
env:
- CI_TYPE=phpstan
- CI_COMPOSER=yes
name: "PHPSTAN - PHP 7.3"
- stage: lint
php: "7.3"
env:
- CI_TYPE=phpcs
- CI_COMPOSER=yes
name: "PHPCS - PHP 7.3"

cache:
apt: true
ccache: true
directories:
- $HOME/.composer/cache/
- $HOME/.cache/bower
- $HOME/.npm
- $HOME/.cache/ci
- /var/cache/apt
- ~/Library/Caches/Homebrew
- $HOME/Library/Caches/Homebrew

before_cache:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew cleanup; fi

addons:
apt:
update: false
packages:
- git
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@ PHP library/api to provide Internationalisation and Localisation
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwdes%2Fphp-I18n-L10n.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fwdes%2Fphp-I18n-L10n?ref=badge_shield)
[![HitCount](https://hits.dwyl.com/wdes/php-I18n-L10n.svg?style=flat)](https://hits.dwyl.com/wdes/php-I18n-L10n)
![Packagist](https://img.shields.io/packagist/l/wdes/php-I18n-L10n.svg)

[![Latest Stable Version](https://poser.pugx.org/wdes/php-I18n-L10n/v/stable)](https://packagist.org/packages/wdes/php-I18n-L10n)

## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwdes%2Fphp-I18n-L10n.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fwdes%2Fphp-I18n-L10n?ref=badge_large)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwdes%2Fphp-I18n-L10n.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fwdes%2Fphp-I18n-L10n?ref=badge_large)

## How to use

```
composer require wdes/php-i18n-l10n
```

Have a look at example file [example/simple.php](example/simple.php)

### Scripts

This package includes some scripts that can be usefull [scripts/tools](scripts/tools)
Here is an example to use them : [scripts/update-example.sh](scripts/update-example.sh)
48 changes: 42 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,48 @@
"type": "library",
"readme": "https://github.com/wdes/php-I18n-l10n/blob/master/README.md",
"license": "MPL-2.0",
"version": "1.0.0-alpha1",
"version": "1.0.0",
"support": {
"email": "williamdes@wdes.fr",
"issues": "https://github.com/wdes/php-I18n-l10n/issues",
"source": "https://github.com/wdes/php-I18n-l10n"
},
"scripts": {
"phpcs": "phpcs --standard=phpcs.xml --no-cache --colors -p -n",
"phpcbf": "phpcbf --standard=phpcs.xml",
"phpstan": "phpstan analyse src tests --configuration=phpstan.neon --level=max",
"phpunit": "phpunit --configuration ./tests/phpunit.xml",
"update:example": "./scripts/update-example.sh"
},
"non-feature-branches": ["dev"],
"archive": {
"exclude": [
"/tests",
"/scripts/ci",
"/.npmignore",
"/.editorconfig",
"/.gitmodules",
"/CODEOWNERS",
"/wdes-php-i18n-l10n-*.tar",
"/docs",
"/.gitignore",
"/phpcs.xml",
"/phpstan.neon",
"/.travis.yml",
"/codecov.yml",
"/.phpunit.result.cache"
]
},
"keywords": [
"i18n",
"l10n",
"mo",
"gettext",
"pot-generator",
"twig",
"library",
"composer-package"
],
"authors": [
{
"name": "William Desportes",
Expand All @@ -28,14 +64,14 @@
}
},
"require": {
"php": "^7.1"
"php": "^7.1",
"twig/twig": "^2.11",
"twig/extensions": "^1.5"
},
"require-dev": {
"phpunit/phpunit": "^7.2",
"squizlabs/php_codesniffer": "^3.3",
"slevomat/coding-standard": "^4.6",
"phpstan/phpstan": "^0.9.2",
"twig/twig": "^2.0",
"twig/extensions": "^1.5"
"slevomat/coding-standard": "^5.0",
"phpstan/phpstan": "^0.11.8"
}
}
53 changes: 53 additions & 0 deletions example/locale/example.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Wdes example.
# Copyright (C) 2019 William Desportes
# This file is distributed under the license http://unlicense.org/UNLICENSE
# William Desportes <williamdes@wdes.fr>
#
#
msgid ""
msgstr ""
"Project-Id-Version: 1.0.0\n"
"Report-Msgid-Bugs-To: williamdes@wdes.fr\n"
"POT-Creation-Date: 2019-06-08 16:28+0200\n"
"PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"

#. l10n: The title of the page
#: example/templates/homepage.twig:2
#: example/templates/homepage.twig:5
msgid "Homepage"
msgstr ""

#: example/templates/homepage.twig:6
msgid "Another format"
msgstr ""

#: example/templates/homepage.twig:7
msgid "A filter"
msgstr ""

#: example/templates/homepage.twig:8
#, php-format
msgid "With \"%s\" apples"
msgstr ""

#: example/templates/homepage.twig:10
#, php-format
msgid "1 database"
msgid_plural "%count% databases"
msgstr[0] ""
msgstr[1] ""

#. l10n: The number of files
#: example/templates/homepage.twig:17
#, php-format
msgid "1 file"
msgid_plural "%count% files"
msgstr[0] ""
msgstr[1] ""
Binary file added example/locale/fr.mo
Binary file not shown.
49 changes: 49 additions & 0 deletions example/locale/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
msgid ""
msgstr ""
"Project-Id-Version: Test\n"
"Report-Msgid-Bugs-To: williamdes@wdes.fr\n"
"POT-Creation-Date: 2019-06-08 16:28+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: Wdes\n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 2.1.1\n"
"X-Poedit-SourceCharset: UTF-8\n"

#. l10n: The title of the page
#: example/templates/homepage.twig:2
#: example/templates/homepage.twig:5
msgid "Homepage"
msgstr "Page d'accueil"

#: example/templates/homepage.twig:6
msgid "Another format"
msgstr "Un autre format"

#: example/templates/homepage.twig:7
msgid "A filter"
msgstr "Un filtre"

#: example/templates/homepage.twig:8
#, php-format
msgid "With \"%s\" apples"
msgstr "Avec des \"%s\" pommes"

#: example/templates/homepage.twig:10
#, php-format
msgid "1 database"
msgid_plural "%count% databases"
msgstr[0] "Une base de données"
msgstr[1] "%count% bases de données"

#. l10n: The number of files
#: example/templates/homepage.twig:17
#, php-format
msgid "1 file"
msgid_plural "%count% files"
msgstr[0] "Un fichier"
msgstr[1] "%count% fichiers"
Loading

0 comments on commit a10c836

Please sign in to comment.