Skip to content
This repository was archived by the owner on Jul 26, 2025. It is now read-only.

Commit d25c5e6

Browse files
committed
Initial commit
0 parents  commit d25c5e6

55 files changed

Lines changed: 3143 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.hack linguist-language=Hack
2+
3+
/tests export-ignore
4+
.travis.sh export-ignore
5+
.travis.yml export-ignore

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/vendor/
2+
composer.lock
3+
*.hhast.parser-cache

.hhconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
assume_php=false
2+
safe_array = true
3+
safe_vector_array = true
4+
unsafe_rx = false
5+
const_default_func_args = true
6+
disallow_array_literal = true
7+
disable_lval_as_an_expression = true
8+
ignored_paths = [ "vendor/.+/tests/.+", "vendor/.+/bin/.+" ]

.travis.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
set -ex
3+
apt update -y
4+
DEBIAN_FRONTEND=noninteractive apt install -y php-cli zip unzip
5+
hhvm --version
6+
php --version
7+
if [ ! -e .git/refs/heads/master ]; then
8+
# - Travis clones with `--branch`, then moves to a detached HEAD state
9+
# - if we're on a detached HEAD, Composer uses master to resolve branch
10+
# aliases.
11+
# So, create the master branch :p
12+
git branch master HEAD
13+
fi
14+
15+
(
16+
cd $(mktemp -d)
17+
curl https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
18+
)
19+
20+
if (hhvm --version | grep -q -- -dev); then
21+
# Doesn't exist in master, but keep it here so that we can test release
22+
# branches on nightlies too
23+
rm -f composer.lock
24+
fi
25+
26+
composer --version
27+
28+
composer install
29+
30+
composer check

.travis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
dist: trusty
2+
language: shell
3+
services: docker
4+
os:
5+
- linux
6+
7+
env:
8+
- HHVM_VERSION=4.25-latest
9+
- HHVM_VERSION=4.30-latest
10+
- HHVM_VERSION=latest
11+
- HHVM_VERSION=nightly
12+
13+
jobs:
14+
allow_failures:
15+
- env: HHVM_VERSION=nightly
16+
17+
install:
18+
- docker pull hhvm/hhvm:$HHVM_VERSION
19+
20+
script:
21+
- docker run --rm -w /var/source -v $(pwd):/var/source hhvm/hhvm:$HHVM_VERSION ./.travis.sh
22+
23+
notifications:
24+
slack:
25+
secure: fZ74Yt9xxelrIZiWBe74X6zCNV+RCbI2aD0EjB8P6d3ovIdyHc+JOe/AFDwUwU8tuKBYt1DpiMnw/rFQQwu2Y6CQnAjgGtG+ScCCVhy5OJvHqFTmMt/XMs9Hrgdylak3IofaI6D/4Du+E9ZMXHgXGVgjQQr0SNMsj1s70sSd97oiW4t4Kn5hxlAbZK7EWCs2BWwyTtVJD96UOEJrBK59lD0wQvfv0wSV948Wwnms70cPgO26Fa+pdBGsv4Ho475Dzu/y4JuO/kqMMzodZtMSm7FNDrppwqgX3qYkfGBI/foQ5IpBn5gGcG5w3RhZLXsNhLDrULcEHtF1Ptfo5PQGUArN8KPRf91Mju2CGICg3wy6GMEm+iXHdPWzUkCaQPhw4ty6ix+fm2ELatXW4BGGXANJzL6UNUGuQPh4Z2oVeX8zEFpUAA+PJRzd6FPYdQDdI3Xj8P445x/KQ+Mg4f2wCR/YKTkjWbkYKzqvjvssgrDGkbQfhXWAOr5/NgKj0/vRovT66Tra14UncjZdM6yHUOqeMq5KfDboEBXoj7+jZG1cQmtSErUoFF2CUyI/Jqva7symsJbjOYSVTKv6BAgoL+CncdLcTPGFLzavLiavkqp4Gd3ErWoeOWqFY0ZYByY4cLcnwLtL0TrY6Y9fdzFeJLmN6xhxTteuw3Ils66K/fw=

LICENSE

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

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<p align="center"><img src="https://avatars3.githubusercontent.com/u/45311177?s=200&v=4"></p>
2+
3+
<p align="center">
4+
<a href="https://travis-ci.org/nuxed/translation"><img src="https://travis-ci.org/nuxed/translation.svg" alt="Build Status"></a>
5+
<a href="https://packagist.org/packages/nuxed/translation"><img src="https://poser.pugx.org/nuxed/translation/d/total.svg" alt="Total Downloads"></a>
6+
<a href="https://packagist.org/packages/nuxed/translation"><img src="https://poser.pugx.org/nuxed/translation/v/stable.svg" alt="Latest Stable Version"></a>
7+
<a href="https://packagist.org/packages/nuxed/translation"><img src="https://poser.pugx.org/nuxed/translation/license.svg" alt="License"></a>
8+
</p>
9+
10+
# Nuxed Translation
11+
12+
The Nuxed Translation component provides tools to internationalize your application.
13+
14+
### Installation
15+
16+
This package can be installed with [Composer](https://getcomposer.org).
17+
18+
```console
19+
$ composer require nuxed/translation
20+
```
21+
22+
### Example
23+
24+
```hack
25+
use namespace Nuxed\Translation;
26+
use namespace Nuxed\Translation\Loader;
27+
28+
<<__EntryPoint>>
29+
async function main(): Awaitable<void> {
30+
$translator = new Translation\Translator('en');
31+
$translator->addLoader('json', new Loader\JsonLoader());
32+
33+
// "translation/messages.en.json"s content :
34+
// {
35+
// "hello": "Hello {name}"
36+
// }
37+
$translator->addResource('json', 'translation/messages.en.json', 'en');
38+
39+
// "translation/messages.fr.json"s content :
40+
// {
41+
// "hello": "Bonjour {name}"
42+
// }
43+
$translator->addResource('json', 'translation/messages.fr.json', 'fr');
44+
45+
echo await $translator->trans('hello', dict['name' => 'saif']); // Hello saif
46+
47+
echo await $translator->trans('hello', dict['name' => 'saif'], 'fr'); // Bonjour saif
48+
}
49+
```
50+
51+
---
52+
53+
### Security
54+
55+
For information on reporting security vulnerabilities in Nuxed, see [SECURITY.md](SECURITY.md).
56+
57+
---
58+
59+
### License
60+
61+
Nuxed is open-sourced software licensed under the MIT-licensed.

SECURITY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Security
2+
3+
If you discover a security vulnerability within Nuxed, please send an e-mail to Saif Eddin Gmati via azjezz@protonmail.com.
4+
5+
Please withhold public disclosure until after we have addressed the vulnerability.
6+
7+
There are no hard and fast rules to determine if a bug is worth reporting as a security issue.

composer.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "nuxed/translation",
3+
"description": "Nuxed Translation",
4+
"type": "library",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "azjezz",
9+
"email": "azjezz@protonmail.com"
10+
},
11+
{
12+
"name": "Nuxed Community",
13+
"homepage": "https://github.com/nuxed/translation/graphs/contributors"
14+
}
15+
],
16+
"require": {
17+
"hhvm": "^4.25",
18+
"hhvm/hsl": "^4.25",
19+
"nuxed/contract": "^0.2",
20+
"hhvm/type-assert": "^3.6",
21+
"nuxed/filesystem": "^1.2",
22+
"nuxed/json": "^1.0"
23+
},
24+
"require-dev": {
25+
"hhvm/hhast": "^4.25",
26+
"hhvm/hacktest": "^2.0",
27+
"facebook/fbexpect": "^2.7"
28+
},
29+
"scripts": {
30+
"check": [
31+
"@type-check",
32+
"@lint",
33+
"@test"
34+
],
35+
"lint": "hhast-lint -v src/",
36+
"test": "hacktest tests/",
37+
"type-check": "hh_client src/"
38+
}
39+
}

hh_autoload.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"roots": [
3+
"src/"
4+
],
5+
"devRoots": [
6+
"tests/"
7+
],
8+
"devFailureHandler": "Facebook\\AutoloadMap\\HHClientFallbackHandler"
9+
}

0 commit comments

Comments
 (0)