Skip to content

Commit f226ed3

Browse files
committed
Initial upload files
0 parents  commit f226ed3

14 files changed

+1122
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_size = 4
6+
indent_style = space
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
phpunit.xml
2+
composer.phar
3+
composer.lock
4+
composer-test.lock
5+
vendor/
6+
build/artifacts/
7+
artifacts/
8+
docs/_build
9+
docs/*.pyc
10+
.git*/
11+
.idea
12+
.DS_STORE

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# CHANGELOG
2+
3+
## 1.0.0 - 2017-01-12
4+
* Added `Josantonius\LanguageCode\LanguageCode` class.
5+
* Added `Josantonius\LanguageCode\LanguageCode::load()` method.
6+
* Added `Josantonius\LanguageCode\LanguageCode::getLanguageFromCode()` method.
7+
* Added `Josantonius\LanguageCode\LanguageCode::getCodeFromLanguage()` method.
8+
* Added `Josantonius\LanguageCode\LanguageCode::getAll()` method.
9+
10+
## 1.0.0 - 2017-01-12
11+
* Added `Josantonius\LanguageCode\Exception\LanguageCodeException` class.
12+
* Added `Josantonius\LanguageCode\Exception\Exceptions` abstract class.
13+
* Added `Josantonius\LanguageCode\Exception\LanguageCodeException->__construct()` method.
14+
15+
## 1.0.0 - 2017-01-12
16+
* Added `Josantonius\LanguageCode\Tests\LanguageCodeTest` class.
17+
* Added `Josantonius\LanguageCode\Tests\LanguageCodeTest::testGetLanguageFromCode()` method.
18+
* Added `Josantonius\LanguageCode\Tests\LanguageCodeTest::testGetLanguageFromCodeUndefined()` method.
19+
* Added `Josantonius\LanguageCode\Tests\LanguageCodeTest::testGetCodeFromLanguage()` method.
20+
* Added `Josantonius\LanguageCode\Tests\LanguageCodeTest::testGetCodeFromLanguageUndefined()` method.
21+
* Added `Josantonius\LanguageCode\Tests\LanguageCodeTest::testGetAll()` method.

CONDUCT.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Contributor Code of Conduct
2+
3+
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4+
5+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
6+
7+
Examples of unacceptable behavior by participants include:
8+
9+
* The use of sexualized language or imagery
10+
* Personal attacks
11+
* Trolling or insulting/derogatory comments
12+
* Public or private harassment
13+
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
14+
* Other unethical or unprofessional conduct.
15+
16+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
17+
18+
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community in a direct capacity. Personal views, beliefs and values of individuals do not necessarily reflect those of the organisation or affiliated individuals and organisations.
19+
20+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
21+
22+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
=====================
3+
4+
Copyright (c) `2017` `Josantonius, https://github.com/Josantonius <info@josantonius.com>`
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy of
7+
this software and associated documentation files (the "Software"), to deal in
8+
the Software without restriction, including without limitation the rights to
9+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10+
of the Software, and to permit persons to whom the Software is furnished to do
11+
so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

README-ES.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# PHP LanguageCode library
2+
3+
[![Latest Stable Version](https://poser.pugx.org/josantonius/languagecode/v/stable)](https://packagist.org/packages/josantonius/languagecode) [![Total Downloads](https://poser.pugx.org/josantonius/languagecode/downloads)](https://packagist.org/packages/josantonius/languagecode) [![Latest Unstable Version](https://poser.pugx.org/josantonius/languagecode/v/unstable)](https://packagist.org/packages/josantonius/languagecode) [![License](https://poser.pugx.org/josantonius/languagecode/license)](https://packagist.org/packages/josantonius/languagecode)
4+
5+
[Spanish version](README-ES.md)
6+
7+
Lista de 217 códigos de idioma: ISO 639-1.
8+
9+
---
10+
11+
- [Instalación](#instalación)
12+
- [Requisitos](#requisitos)
13+
- [Cómo empezar y ejemplos](#cómo-empezar-y-ejemplos)
14+
- [Métodos disponibles](#métodos-disponibles)
15+
- [Uso](#uso)
16+
- [Tests](#tests)
17+
- [Manejador de excepciones](#manejador-de-excepciones)
18+
- [Contribuir](#contribuir)
19+
- [Repositorio](#repositorio)
20+
- [Autor](#autor)
21+
- [Licencia](#licencia)
22+
23+
---
24+
25+
### Instalación
26+
27+
La mejor forma de instalar esta extensión es a través de [composer](http://getcomposer.org/download/).
28+
29+
Para instalar PHP LanguageCode library, simplemente escribe:
30+
31+
$ composer require Josantonius/LanguageCode
32+
33+
### Requisitos
34+
35+
Esta ĺibrería es soportada por versiones de PHP 7.0 o superiores y es compatible con versiones de HHVM 3.0 o superiores.
36+
37+
Para utilizar esta librería en HHVM (HipHop Virtual Machine) tendrás que activar los tipos escalares. Añade la siguiente ĺínea "hhvm.php7.scalar_types = true" en tu "/etc/hhvm/php.ini".
38+
39+
### Cómo empezar y ejemplos
40+
41+
Para utilizar esta librería, simplemente:
42+
43+
```php
44+
require __DIR__ . '/vendor/autoload.php';
45+
46+
use Josantonius\LanguageCode\LanguageCode;
47+
```
48+
### Métodos disponibles
49+
50+
Métodos disponibles en esta librería:
51+
52+
```php
53+
LanguageCode::getLanguageFromCode();
54+
LanguageCode::getCodeFromLanguage();
55+
LanguageCode::getAll();
56+
```
57+
### Uso
58+
59+
Ejemplo de uso para esta librería:
60+
61+
```php
62+
<?php
63+
require __DIR__ . '/vendor/autoload.php';
64+
65+
use Josantonius\LanguageCode\LanguageCode;
66+
67+
LanguageCode::getLanguageFromCode('es');
68+
69+
/* string(7) "Spanish" */
70+
71+
LanguageCode::getLanguageFromCode('abcd');
72+
73+
/* string(9) "undefined" */
74+
75+
LanguageCode::getCodeFromLanguage('spanish');
76+
77+
/* string(2) "es" */
78+
79+
LanguageCode::getCodeFromLanguage('abcd');
80+
81+
/* string(9) "undefined" */
82+
83+
LanguageCode::getAll();
84+
85+
/*
86+
array(217) {
87+
["aa"]=>
88+
string(4) "Afar"
89+
["ab"]=>
90+
string(9) "Abkhazian"
91+
["af"]=>
92+
string(9) "Afrikaans"
93+
["am"]=>
94+
string(7) "Amharic"
95+
["ar"]=>
96+
string(6) "Arabic"
97+
(...)
98+
*/
99+
```
100+
101+
### Tests
102+
103+
Para utilizar la clase de [pruebas](tests), simplemente:
104+
105+
```php
106+
<?php
107+
$loader = require __DIR__ . '/vendor/autoload.php';
108+
109+
$loader->addPsr4('Josantonius\\LanguageCode\\Tests\\', __DIR__ . '/vendor/josantonius/languagecode/tests');
110+
111+
use Josantonius\LanguageCode\Tests\LanguageCodeTest;
112+
```
113+
Métodos de prueba disponibles en esta librería:
114+
115+
```php
116+
LanguageCodeTest::testGetLanguageFromCode();
117+
LanguageCodeTest::testGetLanguageFromCodeUndefined();
118+
LanguageCodeTest::testGetCodeFromLanguage();
119+
LanguageCodeTest::testGetCodeFromLanguageUndefined();
120+
LanguageCodeTest::testGetAll();
121+
```
122+
123+
### Manejador de excepciones
124+
125+
Esta librería utiliza [control de excepciones](src/Exception) que puedes personalizar a tu gusto.
126+
### Contribuir
127+
1. Comprobar si hay incidencias abiertas o abrir una nueva para iniciar una discusión en torno a un fallo o función.
128+
1. Bifurca la rama del repositorio en GitHub para iniciar la operación de ajuste.
129+
1. Escribe una o más pruebas para la nueva característica o expón el error.
130+
1. Haz cambios en el código para implementar la característica o reparar el fallo.
131+
1. Envía pull request para fusionar los cambios y que sean publicados.
132+
133+
Esto está pensado para proyectos grandes y de larga duración.
134+
135+
### Repositorio
136+
137+
Los archivos de este repositorio se crearon y subieron automáticamente con [Reposgit Creator](https://github.com/Josantonius/BASH-Reposgit).
138+
139+
### Autor
140+
141+
Mantenido por [Josantonius](https://github.com/Josantonius/).
142+
143+
### Licencia
144+
145+
Este proyecto está licenciado bajo la **licencia MIT**. Consulta el archivo [LICENSE](LICENSE) para más información.

README.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# PHP LanguageCode library
2+
3+
[![Latest Stable Version](https://poser.pugx.org/josantonius/languagecode/v/stable)](https://packagist.org/packages/josantonius/languagecode) [![Total Downloads](https://poser.pugx.org/josantonius/languagecode/downloads)](https://packagist.org/packages/josantonius/languagecode) [![Latest Unstable Version](https://poser.pugx.org/josantonius/languagecode/v/unstable)](https://packagist.org/packages/josantonius/languagecode) [![License](https://poser.pugx.org/josantonius/languagecode/license)](https://packagist.org/packages/josantonius/languagecode)
4+
5+
[Spanish version](README-ES.md)
6+
7+
List of 217 language codes: ISO 639-1.
8+
9+
---
10+
11+
- [Installation](#installation)
12+
- [Requirements](#requirements)
13+
- [Quick Start and Examples](#quick-start-and-examples)
14+
- [Available Methods](#available-methods)
15+
- [Usage](#usage)
16+
- [Tests](#tests)
17+
- [Exception Handler](#exception-handler)
18+
- [Contribute](#contribute)
19+
- [Repository](#repository)
20+
- [Author](#author)
21+
- [Licensing](#licensing)
22+
23+
---
24+
25+
### Installation
26+
27+
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
28+
29+
To install PHP LanguageCode library, simply:
30+
31+
$ composer require Josantonius/LanguageCode
32+
33+
### Requirements
34+
35+
This library is supported by PHP versions 7.0 or higher and is compatible with HHVM versions 3.0 or higher.
36+
37+
To use this library in HHVM (HipHop Virtual Machine) you will have to activate the scalar types. Add the following line "hhvm.php7.scalar_types = true" in your "/etc/hhvm/php.ini".
38+
39+
### Quick Start and Examples
40+
41+
To use this class, simply:
42+
43+
```php
44+
require __DIR__ . '/vendor/autoload.php';
45+
46+
use Josantonius\LanguageCode\LanguageCode;
47+
```
48+
### Available Methods
49+
50+
Available methods in this library:
51+
52+
```php
53+
LanguageCode::getLanguageFromCode();
54+
LanguageCode::getCodeFromLanguage();
55+
LanguageCode::getAll();
56+
```
57+
### Usage
58+
59+
Example of use for this library:
60+
61+
```php
62+
<?php
63+
require __DIR__ . '/vendor/autoload.php';
64+
65+
use Josantonius\LanguageCode\LanguageCode;
66+
67+
LanguageCode::getLanguageFromCode('es');
68+
69+
/* string(7) "Spanish" */
70+
71+
LanguageCode::getLanguageFromCode('abcd');
72+
73+
/* string(9) "undefined" */
74+
75+
LanguageCode::getCodeFromLanguage('spanish');
76+
77+
/* string(2) "es" */
78+
79+
LanguageCode::getCodeFromLanguage('abcd');
80+
81+
/* string(9) "undefined" */
82+
83+
LanguageCode::getAll();
84+
85+
/*
86+
array(217) {
87+
["aa"]=>
88+
string(4) "Afar"
89+
["ab"]=>
90+
string(9) "Abkhazian"
91+
["af"]=>
92+
string(9) "Afrikaans"
93+
["am"]=>
94+
string(7) "Amharic"
95+
["ar"]=>
96+
string(6) "Arabic"
97+
(...)
98+
*/
99+
```
100+
101+
### Tests
102+
103+
To use the [test](tests) class, simply:
104+
105+
```php
106+
<?php
107+
$loader = require __DIR__ . '/vendor/autoload.php';
108+
109+
$loader->addPsr4('Josantonius\\LanguageCode\\Tests\\', __DIR__ . '/vendor/josantonius/languagecode/tests');
110+
111+
use Josantonius\LanguageCode\Tests\LanguageCodeTest;
112+
113+
```
114+
Available test methods in this library:
115+
116+
```php
117+
LanguageCodeTest::testGetLanguageFromCode();
118+
LanguageCodeTest::testGetLanguageFromCodeUndefined();
119+
LanguageCodeTest::testGetCodeFromLanguage();
120+
LanguageCodeTest::testGetCodeFromLanguageUndefined();
121+
LanguageCodeTest::testGetAll();
122+
```
123+
124+
### Exception Handler
125+
126+
This library uses [exception handler](src/Exception) that you can customize.
127+
### Contribute
128+
1. Check for open issues or open a new issue to start a discussion around a bug or feature.
129+
1. Fork the repository on GitHub to start making your changes.
130+
1. Write one or more tests for the new feature or that expose the bug.
131+
1. Make code changes to implement the feature or fix the bug.
132+
1. Send a pull request to get your changes merged and published.
133+
134+
This is intended for large and long-lived objects.
135+
136+
### Repository
137+
138+
All files in this repository were created and uploaded automatically with [Reposgit Creator](https://github.com/Josantonius/BASH-Reposgit).
139+
140+
### Author
141+
142+
Maintained by [Josantonius](https://github.com/Josantonius/).
143+
144+
### Licensing
145+
146+
This project is licensed under **MIT license**. See the [LICENSE](LICENSE) file for more info.

0 commit comments

Comments
 (0)