Skip to content

Commit

Permalink
.gitignore resync. removed composer.lock
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrián Pardellas Blunier committed Feb 5, 2016
1 parent d8eac06 commit 07332b9
Show file tree
Hide file tree
Showing 25 changed files with 1,486 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/vendor
/bin
composer.phar
composer.lock
.DS_Store
.idea
19 changes: 19 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
checks:
php:
code_rating: true
duplication: true

filter:
paths:
- src/*
excluded_paths:
- tests/*

build:
tests:
override:
-
command: phpunit --coverage-clover=coverage
coverage:
file: coverage
format: php-clover
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
language: php

php:
- 5.5
- 5.6
- hhvm

before_script:
- travis_retry composer self-update
- travis_retry composer install --prefer-source --no-interaction

script: phpunit --coverage-text

notifications:
email:
- "[email protected]"
- "[email protected]"
84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Anavel translation [![Build Status](https://travis-ci.org/anavel/translation.svg?branch=master)](https://travis-ci.org/anavel/translation)

Manage laravel translation files from your admin panel. This package depends on [Anavel foundation](https://github.com/anavel/foundation)

### Features

* Easily manage app and vendor translation files.
* Automatically reorders translations (alphabetically)
* Easily create new language lines
* Arrays supported

## Installation


## Configuration

Publish translation config file with `php artisan vendor:publish`

Include the files you want to manage within the `files` array, like this:

```
/*
|--------------------------------------------------------------------------
| Files to translate
|--------------------------------------------------------------------------
|
*/
'files' => [
'user' => [
'aFileName',
'anotherFileName'
],
'vendor' => [
'vendorname' => 'vendorFileName'
]
],
```

`user` is an array of filenames (without extension) located in Laravel's default folder (resources/lang/LOCALE_NAME).
`vendor` is an associative array of filenames (without extension), keyed by vendorname, located in Laravel's default folder (resources/lang/vendor/VENDORNAME/LOCALE_NAME).

This package will read and then write those files, so your app must have write permissions to those folders. You must specify a disc driver for Laravel to use:

config/anavel-translation.php:

```
/*
|--------------------------------------------------------------------------
| File Disc Driver
|--------------------------------------------------------------------------
|
| Disc driver pointing to resources/lang folder
|
*/
'filedriver' => 'YOUR_DRIVER_NAME',
```

config/filesystem.php:

```
'disks' => [
[SOME OTHER FILE DRIVERS ],
'YOUR_DRIVER_NAME' => [
'driver' => 'local',
'root' => base_path('resources/lang'),
],
]
```

## Versioning

If you use a versioning system (such as git) you should add the language folder to your gitignore. Otherwise, you might
get conflicts if different users update the translations.

## How it works

Translations reads the files that you specify in the config and displays their content in a form, tabbed by locale.
The translation key becomes the input label and the translation itself becomes the input value.
Locales are taken from the Anavel foundation config.

To make the translation process easier, Translation shows the same language entries in all locales, even if a key is missing in a given locale.
In that case, the displayed text will be taken from the fallback locale (as Laravel does).

When saved, translations are written back to the files. If a file doesn't exist in a locale, a new one is created.
37 changes: 37 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "anavel/translation",
"description": "Manage laravel translation files from your admin panel",
"authors": [
{
"name": "Adrian P. Blunier",
"email": "[email protected]"
},
{
"name": "Carlos Morales",
"email": "[email protected]"
}
],
"require": {
"php": ">=5.5.9",
"illuminate/support": "5.1.*",
"illuminate/translation": "5.1.*",
"anavel/foundation": "dev-master"
},
"require-dev": {
"orchestra/testbench": "~3.1",
"phpunit/phpunit": "~4.0",
"whatthejeff/nyancat-phpunit-resultprinter": "~1.2",
"mockery/mockery": "^0.9.4"
},
"autoload": {
"psr-4": {
"Anavel\\Translation\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Anavel\\Translation\\Tests\\": "tests"
}
},
"minimum-stability": "stable"
}
44 changes: 44 additions & 0 deletions config/anavel-translation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

return [
/*
|--------------------------------------------------------------------------
| Displayed name
|--------------------------------------------------------------------------
|
*/
'name' => 'Translation',

/*
|--------------------------------------------------------------------------
| Displayed icon
|--------------------------------------------------------------------------
|
*/
'icon' => 'fa-globe',

/*
|--------------------------------------------------------------------------
| Files to translate
|--------------------------------------------------------------------------
|
*/
'files' => [
'user' => [

],
'vendor' => [

]
],

/*
|--------------------------------------------------------------------------
| File Disc Driver
|--------------------------------------------------------------------------
|
| Disc driver pointing to resources/lang folder
|
*/
'filedriver' => 'lang',
];
29 changes: 29 additions & 0 deletions lang/en/messages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

return [
'create_title' => 'Create',
'edit_title' => 'Edit',
'show_title' => 'Show',
'search_input' => 'Search',
'create_button' => 'Create',
'empty_list' => 'Empty table',
'actions_table_header' => 'Actions',
'show_button' => 'Show',
'edit_button' => 'Edit',
'delete_button' => 'Delete',
'back_button' => 'Back',
'cancel_button' => 'Cancel',
'save_button' => 'Save',
'confirm_button' => 'Confirm',
'alert_translations_saved_title' => 'Everything OK!',
'alert_translations_saved_text' => 'The new item was saved successfully',
'alert_translations_destroy_title' => 'Everything OK!',
'alert_translations_destroy_text' => 'The item was deleted successfully',
'alert_empty_translations_title' => 'Nothing to update!',
'alert_empty_translations_text' => 'No translations sent',
'new_line' => 'New translation line',
'new_line_key_label' => 'Key',
'new_line_key_placeholder' => 'You can create arrays using dots: mainkey.key',
'new_line_value_label' => 'Translation',
'new_button' => 'Add new',
];
29 changes: 29 additions & 0 deletions lang/es/messages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

return [
'create_title' => 'Crear',
'edit_title' => 'Editar',
'show_title' => 'Ver',
'search_input' => 'Buscar',
'create_button' => 'Crear',
'empty_list' => 'Tabla vacía',
'actions_table_header' => 'Acciones',
'show_button' => 'Ver',
'edit_button' => 'Editar',
'delete_button' => 'Borrar',
'back_button' => 'Volver',
'cancel_button' => 'Cancelar',
'save_button' => 'Guardar',
'confirm_button' => 'Confirmar',
'alert_translations_saved_title' => '¡Todo bien!',
'alert_translations_saved_text' => 'El elemento ha sido guardado correctamente',
'alert_translations_destroy_title' => '¡Todo bien!',
'alert_translations_destroy_text' => 'El elemento ha sido borrado correctamente',
'alert_empty_translations_title' => '¡Nada que actualizar!',
'alert_empty_translations_text' => 'No se han recibido traducciones',
'new_line' => 'Nueva línea de traducción',
'new_line_key_label' => 'Clave',
'new_line_key_placeholder' => 'Puedes crear arrays usando puntos: claveprincipal.clave',
'new_line_value_label' => 'Traducción',
'new_button' => 'Añadir nueva',
];
29 changes: 29 additions & 0 deletions lang/gl/messages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

return [
'create_title' => 'Crear',
'edit_title' => 'Editar',
'show_title' => 'Ver',
'search_input' => 'Buscar',
'create_button' => 'Crear',
'empty_list' => 'Táboa vacía',
'actions_table_header' => 'Accións',
'show_button' => 'Ver',
'edit_button' => 'Editar',
'delete_button' => 'Borrar',
'back_button' => 'Volver',
'cancel_button' => 'Cancelar',
'save_button' => 'Gardar',
'confirm_button' => 'Confirmar',
'alert_translations_saved_title' => '¡Todo ben!',
'alert_translations_saved_text' => 'O elemento foi gardado correctamente',
'alert_translations_destroy_title' => 'Todo ben!',
'alert_translations_destroy_text' => 'O elemento foi borrado correctamente',
'alert_empty_translations_title' => '¡Nada que actualizar!',
'alert_empty_translations_text' => 'Non se recibiron traducións',
'new_line' => 'Nova liña de tradución',
'new_line_key_label' => 'Clave',
'new_line_key_placeholder' => 'Podes crear arrays usando puntos: claveprincipal.clave',
'new_line_value_label' => 'Tradución',
'new_button' => 'Engadir nova',
];
26 changes: 26 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
printerFile="vendor/whatthejeff/nyancat-phpunit-resultprinter/src/NyanCat/PHPUnit/ResultPrinter.php"
printerClass="NyanCat\PHPUnit\ResultPrinter"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
</phpunit>
Loading

0 comments on commit 07332b9

Please sign in to comment.