Compare commits

..
7 Commits
Author SHA1 Message Date
Fred Delrieu e1714136d4 Merge pull request #374 from blueberry-media/patch-1
added some common attributes to validation.php
2015-06-08 14:59:35 +02:00
BlueBerry 55e8c36cda added some common attributes to validation.php 2015-06-08 13:23:30 +02:00
Fred Delrieu 57bdaeaa6f Update with #364 2015-04-01 21:17:44 +02:00
Fred Delrieu 776cb2e96a (fa) update with #363 2015-04-01 21:16:17 +02:00
caouecs a3d6115daa feature: fr - update validation with #362 2015-03-30 19:56:53 +02:00
caouecs 32c0eca8d9 fix: name of package 2015-03-29 22:53:31 +02:00
caouecs 439ba86dea feature: new readme 2015-03-29 22:38:06 +02:00
1287 changed files with 7715 additions and 209603 deletions

No files matched your search

-14
View File
@@ -1,14 +0,0 @@
* text=auto
.github/ export-ignore
tests/ export-ignore
app/ export-ignore
docs/ export-ignore
excludes/ export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
phpunit.xml export-ignore
-15
View File
@@ -1,15 +0,0 @@
---
name: "Bug report"
about: "Report something that's broken. Please ensure your Laravel version is still supported: https://github.com/Laravel-Lang/lang#via-composer"
---
<!-- DO NOT THROW THIS AWAY -->
<!-- Fill out the FULL versions with patch versions -->
- Laravel-Lang Version: #.#.#
- PHP Version: #.#.#
### Description:
### Steps To Reproduce:
-11
View File
@@ -1,11 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: Feature, Questions & Other
url: https://github.com/Laravel-Lang/lang/discussions
about: 'If you have a question or need help using the library, click:'
- name: Laravel issue
url: https://laravel.com/docs
about: 'If you have a question about your Laravel implementation, ask it in your Laravel project.'
- name: Package Manager issue
url: https://github.com/Laravel-Lang/lang#projects-based-on-this-package
about: 'If you have a question about the work of a translation manager, ask their developers:'
-28
View File
@@ -1,28 +0,0 @@
name: phpunit
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
name: PHP Unit
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json
coverage: none
- name: Composer self update
run: composer self-update
- name: Install dependencies
run: composer update --prefer-stable --prefer-dist --no-progress --no-interaction
- name: Execute tests
run: sudo vendor/bin/phpunit
-97
View File
@@ -1,97 +0,0 @@
name: self-update
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
name: Keys actualization and update status of translations
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json
coverage: none
- name: Git setup
if: success()
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Install dependencies
run: composer update --prefer-stable --prefer-dist --no-progress --no-interaction
- name: Scanning packages
id: commit_packages
if: success()
run: |
IS_DIRTY=1
php app/packages.php
{ git add . && git commit -a -m "Updating package files"; } || IS_DIRTY=0
echo ::set-output name=is_dirty::${IS_DIRTY}
- name: Keys actualization
id: commit_keys
if: success()
run: |
IS_DIRTY=1
php app/keys.php
{ git add . && git commit -a -m "Updating translations keys"; } || IS_DIRTY=0
echo ::set-output name=is_dirty::${IS_DIRTY}
- name: Updating referents
id: referents
if: success()
run: |
IS_DIRTY=1
php app/referents.php
{ git add . && git commit -a -m "Updating the `docs/referents.md` file"; } || IS_DIRTY=0
echo ::set-output name=is_dirty::${IS_DIRTY}
- name: Checking for excludes
id: excludes
if: success()
run: |
IS_DIRTY=1
php app/excludes.php
{ git add . && git commit -a -m "Updating excludes files"; } || IS_DIRTY=0
echo ::set-output name=is_dirty::${IS_DIRTY}
- name: Status update
id: commit_status
if: success()
run: |
IS_DIRTY=1
php app/status.php
{ git add . && git commit -a -m "Updated status of translations"; } || IS_DIRTY=0
echo ::set-output name=is_dirty::${IS_DIRTY}
- name: Push changes
uses: ad-m/github-push-action@master
if: success() && (steps.commit_packages.outputs.is_dirty == 1 || steps.commit_keys.outputs.is_dirty == 1 || steps.referents.outputs.is_dirty == 1 || steps.excludes.outputs.is_dirty == 1 || steps.commit_status.outputs.is_dirty == 1)
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
+2 -14
View File
@@ -1,15 +1,3 @@
.idea/
_site/
vendor/
build/
_site
/vendor/
.DS_Store
.php_cs.cache
.phpintel
*.bak
*.cache
*.clover
*.orig
composer.lock
+511
View File
@@ -0,0 +1,511 @@
# Changelog
16 December 2014
* Add Lithunian (lt) by [trigras](https://github.com/trigras)
17 November 2014
* Update French (fr) by [Youghourta Benali](https://github.com/djug)
16 November 2014
* Update Portuguese (pt) by [Francisco Neves](https://github.com/fntneves)
* Update Arabic (ar) by [Youghourta Benali](https://github.com/djug)
14 November 2014
* Update Swedish (sv) by [Robin Hallabro](https://github.com/hallabro)
31 October 2014
* Update Catalan (ca) by [Gerard Nesta](https://github.com/gerardnll)
22 October 2014
* Update Farsi (fa) by [Reza](https://github.com/PlangCoder)
14 October 2014
* Update Bosnian (bs) by [mrakodol](https://github.com/mrakodol)
05 October 2014
* Update Indonesian (id) by [Ivo Idham Perdameian](https://github.com/idhamperdameian)
30 September 2014
* Update Turkish (tr) for validation.email by [Isa Ishangulyyev](https://github.com/isa424)
28 September 2014
* Update Turkish (tr) for reminders.reset and validation.timezone by [azakhi](https://github.com/azakhi)
22 September 2014
* Update Bulgarian (bg) for reminders.reset by [Roumen Damianoff](https://github.com/RoumenDamianoff)
* Update German (de) for reminders.reset, validation.boolean and validation.timezone by [Marius Gebhardt](https://github.com/gbhrdt)
* Update Greek (el) for reminders and validations by [Nikos Gr](https://github.com/grrnikos)
18 September 2014
* Update Spanish (es) for reminders.reset and validation.timezone by [Facundo Farias](https://github.com/facundofarias)
15 September 2014
* Update Italian (it) for validations and reminders.reset by [Budi Irawan](https://github.com/deerawan)
14 September 2014
* Update Vietnamese (vi) for reminders.reset and validation.timezone by [Nguyễn Văn Ánh](https://github.com/anhskohbo)
10 September 2014
* Update Bulgarian (bg) for validation.timezone, required*, boolean by [starstreak](https://github.com/starstreak)
08 September 2014
* Update Polish (pl) by [Jakub Syty](https://github.com/Nekromancer)
06 September 2014
* Add Turkmen (tk) by [Isa Ishangulyyev](https://github.com/isa424)
05 September 2014
* Update Dutch (nl) for validation.timezone by [Mark Mooibroek](https://github.com/markmooibroek)
03 September 2014
* Update Dutch (nl) for reminders.reset by [Mark Mooibroek](https://github.com/markmooibroek)
* Update Thai (th) for reminders.reset, validation.boolean, validation.timezone by [Pachara Limkraisan](https://github.com/kthoth)
26 August 2014
* Update Korean (ko) for reminders.reset, reminders.send, validation by [dbwhddn10](https://github.com/dbwhddn10)
* Update Traditional Chinese (Hong Kong) (zh-HK), Chinese from Taiwan (zh-TW) and Chinese (zh-CN) for validation.timezone and reminders.reset by [Carlos](https://github.com/overtrue)
25 August 2014
* Update Portuguese (pt) for validation.timezone by [miguelbgouveia](https://github.com/miguelbgouveia)
* Update Brazilian (pt-BR) for validation.timezone and reminders.reset by [miguelbgouveia](https://github.com/miguelbgouveia)
* Update Swedish (sv) for reminders.reset and validation.timezone by [Christoffer Rydberg](https://github.com/murum)
24 August 2014
* Update Russian (ru) for reminders.reset and validation.timezone by [Evgeny Kovalev](https://github.com/EvgenyKovalev)
23 August 2014
* Add reminders.reset and validation.timezone for all languages
* Update French (fr) for reminders.reset and validation.timezone by [Fred Delrieu](https://github.com/caouecs)
12 August 2014
* Update Traditional Chinese (Hong Kong) (zh-HK) by [Eric Li](https://github.com/ericksli)
10 August 2014
* Update Brazilian (pt-BR) and Portuguese (pt) for validation.boolean by
* Update Hungarian (hu) by [Zsombor Franczia](https://github.com/frzsombor)
2 August 2014
* Update Swedish (sv) for validation.boolean by [coldKingdom](https://github.com/coldKingdom)
27 July 2014
* Update Indonesian (id) for validation.boolean by [Ivo Idham Perdameian](https://github.com/idhamperdameian)
24 July 2014
* Update Vietnamese (vi) for validation.boolean by [Nguyễn Văn Ánh](https://github.com/anhskohbo)
17 July 2014
* Update French (fr) for reminders.user by [Erwan](https://github.com/NaWer)
16 July 2014
* Update Spanish (es) for validation.boolean by [sauralph](https://github.com/sauralph)
9 July 2014
* Update Turkish (tr) for validation.boolean, validation.required_with_all and validation.required_without_all by [Fatih AYTAÇ](https://github.com/computeus)
8 July 2014
* Update Chinese from Taiwan for validation.boolean by [Joy](https://github.com/joychao)
* Update Traditional Chinese (Hong Kong) (zh-HK) and Chinese (zh-CN) for validation.boolean and validation.exists by [Joy](https://github.com/joychao)
27 June 2014
* Update Thai (th) for reminders.send by [chotikarn](https://github.com/chotikarn)
* Update Brazilian (pt-BR) for validation.unique by [Ricardo Fuhrmann](https://github.com/Fuhrmann)
19 June 2014
* Update Brazilian (pt-BR) for validation.boolean and validation.required_with_all by [miguelbgouveia](https://github.com/miguelbgouveia)
* Update Portuguese (pt) for validation.boolean and validation.required_with_all by [miguelbgouveia](https://github.com/miguelbgouveia)
* Update Spanish (es) for validation.active_url by Benjamin Worwa
11 June 2014
* Update Danish (da) for validation.boolean by [Daniel Bøndergaard](https://github.com/danielboendergaard)
10 June 2014
* Update French (fr) for validation.boolean by [Fred Delrieu](https://github.com/caouecs)
* Update Russian (ru) for validation.boolean by [Evgeny Kovalev](https://github.com/EvgenyKovalev)
* Add validation.boolean for all languages
09 June 2014
* Update Macedonian (mk) by [Marko Aleksic](https://github.com/psybaron)
31 May 2014
* Update Bosnian (bs) by [Edis Golubić](https://github.com/golubic)
24 May 2014
* Update Japanese (ja) by [Yuya Takahashi](https://github.com/takahashiyuya)
15 May 2014
* Update Swedish (sv) by [Alexander Wallin](https://github.com/alexanderwallin)
27 April 2014
* Update Persian (fa) by [Siamak A.M](https://github.com/blacksrc)
20 April 2014
* Add Saridinian (sa) by Massimeddu Cireddu
18 April 2014
* Update Chinese (zh-CN) by [JohnLui](https://github.com/johnlui)
14 April 2014
* Add Persian (fa) by [Siamak A.M](https://github.com/blacksrc)
11 April 2014
* Update Russian (ru) by [Evgeny Kovalev](https://github.com/EvgenyKovalev)
07 April 2014
* Update Chinese (zh-CN) by [Joy](https://github.com/joychao)
* Update Chinese from Hong Kong (zh-HK) by [Joy](https://github.com/joychao)
* Add Chinese from Taiwan (zh-TW) by [Joy](https://github.com/joychao)
* Update Japanese (ja) for validation by [Yuya Takahashi](https://github.com/takahashiyuya)
04 April 2014
* Update German (de) for reminders and validation.required_with_all by [lanort](https://github.com/lanort)
* Update Japanese (ja) for reminders by [Yuya Takahashi](https://github.com/takahashiyuya)
03 April 2014
* Update Swedish (sv) for validation.required_without_all, new validation.email and validation.required_with_all by [coldKingdom](https://github.com/coldKingdom)
31 March 2014
* Update Arabic (ar) for fix, validation.required_without_all and validation.required_with_all by [bo3bdo](https://github.com/bo3bdo)
29 March 2014
* Update Spanish (es) for validation.required_without_all and validation.required_with_all by [Anton Zekeriev Rodin](https://github.com/antonrodin)
14 March 2014
* Update French (fr) with fix by [Elyahou](https://github.com/Elyahou)
12 March 2014
* Update Dutch (nl) with `required_*` by [Herman](https://github.com/sintemaa)
* Update Danish (da) with fix by [Daniel Bøndergaard](https://github.com/danielboendergaard)
05 March 2014
* Update Indonesian (id) with Translated lines description by [Ivo Idham Perdameian](https://github.com/idhamperdameian)
03 March 2014
* Add Montenegrin (me) by [Ognjen MIletić](https://github.com/ognjenm)
* Update Bosnian (bs) for reminders.send and validation.required_without_all by [mrakodol](https://github.com/mrakodol)
* Update Danish (da) for validation.required_without_all, new validation.email and validation.required_with_all by [Daniel Bøndergaard](https://github.com/danielboendergaard)
* Update French (fr) for validation.between.array by [Alex-Info.net](https://github.com/AlexInfoNet)
02 March 2014
* Fix on Russian (ru) for validation.required_with_all by [Evgeny Kovalev](https://github.com/EvgenyKovalev)
01 March 2014
* Update Indonesian (id) for validation.required_with_all by [Ivo Idham Perdameian](https://github.com/idhamperdameian)
* Update French (fr) with validation.required_with_all by [Fred Delrieu](https://github.com/caouecs)
* Update all languages with example for custom message by [Ivo Idham Perdameian](https://github.com/idhamperdameian)
* All validation.required_with_all in all languages ( english version ) by [Fred Delrieu](https://github.com/caouecs)
28 February 2014
* Update Russian (ru) for validation.required_with_all and example for custom message by [Evgeny Kovalev](https://github.com/EvgenyKovalev)
* Update French (fr) with validation.attributes.password_confirmation by [Barbuslex](https://github.com/barbuslex)
* Update Vietnamese (vi) for new validation.email and validation.required_without_all by [anhsaker](https://github.com/anhsaker)
27 February 2014
* Update Russian (ru) for new validation.email by [Evgeny Kovalev](https://github.com/EvgenyKovalev)
* Update Indonesian (id) for fix, validation.required_without_all and new validation.email by [Ivo Idham Perdameian](https://github.com/idhamperdameian)
26 February 2014
* Update German (de) for validation.required_without_all by [justb81](https://github.com/justb81)
* Update Romanian (ro) by [Vadim](https://github.com/cojocaru)
25 February 2014
* Update Romanian (ro) by [Vadim](https://github.com/cojocaru)
18 February 2014
* Update Serbian (sr) for reminders and validation files by [Adis](https://github.com/adis-me)
07 February 2014
* Add Cambodian (km) by [Chanthoeun Kim](https://github.com/Chanthoeun)
* Update Russian (ru) for validation.required_without_all by [Evgeny Kovalev](https://github.com/EvgenyKovalev)
* Update Portuguese (pt) and Brazilian (pt-BR) for validation.required_without_all [miguelbgouveia](https://github.com/miguelbgouveia)
* Update Swedish (sv) and Finnish (fi) by [Linus Odenring](https://github.com/linusodenring)
06 February 2014
* Update French (fr) with validation.required_without_all by [Fred Delrieu](https://github.com/caouecs)
* Add validation.required_without_all in English for all files
* Update Swedish (sv) and Finnish (fi) by [Linus Odenring](https://github.com/linusodenring)
05 February 2014
* Update French (fr) by [Alexandre Butynski](https://github.com/alexandre-butynski)
28 January 2014
* Update Arabic (ar) by [Ihab Shoully](https://github.com/shoully)
26 January 2014
* Update Brazilian (pt-BR) for Laravel 4.1 by [Gabriel Machado](https://github.com/gmsantosxl)
* Update Slovak (sk) by [Andrej Badin](https://github.com/Andreyco)
22 January 2014
* Update Italian (it) by [Davide Bellini](https://github.com/billmn)
* Update Arabic (ar) for Laravel 4.1 by [Ihab Shoully](https://github.com/shoully)
15 January 2014
* Update Danish (da) for Laravel 4.1 by [Daniel Bøndergaard](https://github.com/danielboendergaard)
13 January 2014
* Update Swedish and Norwegian Bokmål for Laravel 4.1 by [thomeu](https://github.com/thomeu)
10 January 2014
* Update Indonesian (id) for Laravel 4.0 and 4.1 by [Ivo Idham Perdameian](https://github.com/idhamperdameian)
09 January 2014
* Update Turkish (tr) for Laravel 4.1 by [Arda Kılıçdağı](https://github.com/Ardakilic)
* Update Polish (pl) for Laravel 4.0 and 4.1 by [Marcin Sągol](https://github.com/soee)
30 December 2013
* Update Czech (cs) for Laravel 4.1 by [rozklad](https://github.com/rozklad)
29 December 2013
* Update Italian (it) for Laravel 4.1 by [alextesi](https://github.com/alextesi)
28 December 2013
* Update German (de) for Laravel 4.1 by [Gerald Lindner](https://github.com/vauteer)
23 December 2013
* Update Greek (el) for Laravel 4.1 by [dimsav](https://github.com/dimsav)
17 December 2013
* Fix Spanish (es) by [Javier Cadiz](https://github.com/cadizjavier)
16 December 2013
* Fix Slovak (sk) by [Roumen Damianoff](https://github.com/RoumenDamianoff)
* Update Bulgarian (bg) for Laravel 4.0 and Laravel 4.1 by [Roumen Damianoff](https://github.com/RoumenDamianoff)
15 December 2013
* Update Arabic (ar) for Laravel 4.1 by [Ammar Alakkad](https://github.com/AAlakkad)
12 December 2013
* Update Catalan (ca) and Spanish (es) for Laravel 4.1 by [David Moreno](https://github.com/davidmb91)
* Update Portuguese (pt) for Laravel 4.1 by [miguelbgouveia](https://github.com/miguelbgouveia)
01 December 2013
* Update Vietnamese (vi) for Laravel 4.1 by [anhsaker](https://github.com/anhsaker)
21 November 2013
* Add reminders.sent in develop branch for Laravel 4.1
* Update French (fr) by [Fred Delrieu](https://github.com/caouecs)
* Update Russian (ru) by [Evgeny Kovalev](https://github.com/EvgenyKovalev)
18 November 2013
* Add Macedonian (mk) by [maced0n](https://github.com/maced0n)
10 November 2013
* Add Catalan (ca) by [David Moreno](https://github.com/davidmb91)
09 Novembre 2013
* Array elements (it) and (ro) by [Ionut Tanasa](https://github.com/ionut-tanasa)
02 November 2013
* Add Korean (ko) by [Kaden Lee](https://github.com/thisiskaden)
30 October 2013
* Add Slovak (sk) by [Martin Olšanský](https://github.com/MartinOlsansky)
* Add Czech (cs) by [rozklad](https://github.com/rozklad)
27 October 2013
* Add Norwegian Bokmål (nb) by [Marius](https://github.com/mariuso)
23 October 2013
* Array elements (th) by [chotikarn](https://github.com/chotikarn)
18 October 2013
* Fix Russian (ru) by [Vasily Tsybenko](https://github.com/VasayXTX)
16 October 2013
* Add Bosnian (bs) by [mrakodol](https://github.com/mrakodol)
01 October 2013
* Fix German (de) by [nullEuro](https://github.com/nullEuro)
20 Septembre 2013
* Fix Portuguese (pt) by [miguelbgouveia](https://github.com/miguelbgouveia)
19 September 2013
* Array elements (pt-BR) by [insign](https://github.com/insign)
06 September 2013
* Fix german (de) by [lanort](https://github.com/lanort)
18 August 2013
* Array elements (el) by [Konstantinos Pittas](https://github.com/kostaspt)
14 August 2013
* Array elements (tr) by [Sinan Eldem](https://github.com/sineld)
* Array elements (ru) by [EvgenyKovalev](https://github.com/EvgenyKovalev)
* Array elements (de) by [Jones](https://github.com/JN-Jones)
13 August 2013
* Array elements (es) by [Nikoskip](https://github.com/nikoskip)
12 August 2013
* Array elements (nl) by [juukie14](https://github.com/juukie14)
05 August 2013
* Fix Arabic (ar) by [Ibrahim AshShohail](https://github.com/laheab)
* Add array elements
04 August 2013
* Fix German (de) by [iflow](https://github.com/iflow)
30 July 2013
* Add Brazilian (pt-BR) by [c0h1b4](https://github.com/c0h1b4)
* Update Brazilian (pt-BR) by [miguelbgouveia](https://github.com/miguelbgouveia)
* Add Vietnamese (vi) by [anhsaker](https://github.com/anhsaker)
19 July 2013
* Update Swedish (sv) by [Jonas Söderberg](https://github.com/imevul)
12 July 2013
* Review (pt) by [miguelbgouveia](https://github.com/miguelbgouveia)
06 July 2013
* Add validation.attributes (fr) by [Fred Delrieu](https://github.com/caouecs)
* Indentation
04 July 2013
* Add Thai (th) by [teepluss](https://github.com/teepluss)
* Add many languages files from Laravel3 - need review
02 July 2013
* ISO 639-1 for Danish (dk->da) by [Fred Delrieu](https://github.com/caouecs)
22 June 2013
* Review (nl) by [Thomasdezeeuw](https://github.com/Thomasdezeeuw)
17 June 2013
* Review (nl) by [jaspur](https://github.com/jaspur)
14 June 2013
* Add Hungarian (hu) by [terdelyi](https://github.com/terdelyi)
* Add Portuguese (pt) by [miguelbgouveia](https://github.com/miguelbgouveia)
13 June 2013
* Review Danish (dk) by [hauthorn](https://github.com/hauthorn)
11 June 2013
* Review (tr) by [pellempus](https://github.com/pellempus)
09 June 2013
* Add Danish (dk) by [AndreasHeiberg](https://github.com/AndreasHeiberg)
07 June 2013
* Add Greek (el) by [igaster](https://github.com/igaster)
* Update (es) by [Nikoskip](https://github.com/nikoskip)
04 June 2013
* Add traditional chinese (HK) by [efilm](https://github.com/efilm)
* Add attributes (ar) by [AAlakkad](https://github.com/AAlakkad)
* Review (nl) by [jeroengerits](https://github.com/jeroengerits)
-21
View File
@@ -1,21 +0,0 @@
# MIT License
Copyright (c) 2021 Laravel-Lang team
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
+121 -22
View File
@@ -1,30 +1,129 @@
# Laravel Lang
Laravel-lang
=============
In this repository, you can find the lang files for the [Laravel Framework 4/5/6/7/8](https://laravel.com), [Laravel Jetstream](https://jetstream.laravel.com) , [Laravel Fortify](https://github.com/laravel/fortify), [Laravel Cashier](https://laravel.com/docs/8.x/billing), [Laravel Nova](https://nova.laravel.com) and [Laravel Spark](https://spark.laravel.com).
In this repository, you can find the lang files for the framework PHP, [Laravel 4&5](http://www.laravel.com).
<p align="center">
[
<a href="https://laravel-lang.github.io/lang">Documentation</a> |
<a href="https://laravel-lang.github.io/lang/status.html">Completion Status</a>
]
</p>
---
## News
How add languages in my app ?
---
* in version 10, we split translation keys into Laravel packages ([#1748](https://github.com/Laravel-Lang/lang/pull/1748), [discussion](https://github.com/Laravel-Lang/lang/discussions/1702#discussioncomment-703215))
* in version 9.1, we include machine translations, with review by humans for some languages ( see [Discussions](https://github.com/Laravel-Lang/lang/discussions/1692) )
* in version 9, we propose new structure of files ( see [#1606](https://github.com/Laravel-Lang/lang/discussions/1606), [#1607](https://github.com/Laravel-Lang/lang/pull/1607) )
* in version 8, we propose new directory names to follow Php Intl ( see [#1453](https://github.com/Laravel-Lang/lang/pull/1453) )
* in version 7, we propose new directory names to follow ISO-15897 ( see [#1269](https://github.com/Laravel-Lang/lang/issues/1269) )
* in version 6.1, we propose a new file by language: `validation-inline.php` ( see [#1268](https://github.com/Laravel-Lang/lang/issues/1268) )
### Installation by GitHub
## Translation managers
* Clone the [GitHub repository](https://github.com/caouecs/laravel-lang/) : *git clone https://github.com/caouecs/laravel-lang.git*
* Or download the [zip file](https://github.com/caouecs/laravel-lang/archive/master.zip)
* Choose the branch:
* `laravel4` for Laravel4 project
* `master` for Laravel5 project
* Copy the folders of languages that you want, in *app/lang* folder of your application Laravel
* [LaravelLang](https://github.com/ARCANEDEV/LaravelLang) by [*@arcanedev-maroc*](https://github.com/ARCANEDEV) - Translations manager and checker for Laravel.
* [Laravel-lang](https://github.com/overtrue/laravel-lang) by [*@overtrue*](https://github.com/overtrue) - Command to add languages in your project.
* [Lang Publisher](https://github.com/andrey-helldar/laravel-lang-publisher) by [*@andrey-helldar*](https://github.com/andrey-helldar) - Easy installation and update of translation files for your project.
## Credits
### Installation by Composer
- [Referents by language](https://laravel-lang.github.io/lang/referents.html)
- [All Contributors](https://github.com/Laravel-Lang/lang/graphs/contributors)
* For Laravel 4 : add `"caouecs/laravel4-lang": "~1.0"` in your `composer.json` in "require" or run *composer require caouecs/laravel4-lang*
* For Laravel 5 : add `"caouecs/laravel4-lang": "~2.0"` in your `composer.json` in "require"
* Do "composer update"
* Files of languages are in "vendor/caouecs/laravel4-lang" directory
* Copy the folders of languages that you want, in *app/lang* folder of your application Laravel
### Installation by Command
If you have a Laravel5 project, you can use `laravel-lang` project of overtrue : *composer require "overtrue/laravel-lang:dev-master"*
### Language by default in your app
In the file *app/config/app.php*, change the value of *language* by the short name of your language.
---
How can I add a language in this project ?
---
* fork this repository
* create a directory with the short name of the language (ex: fr for French) from ISO-639-1 ( see [Wikipedia](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) )
* copy this three files of the english version with your translate
* for [Laravel](https://github.com/laravel/laravel/tree/master/app/lang/en)
* add a pull request with the name of the language
How can I fix a file ?
---
* fork this repository
* update the file
* add a pull request with the name of the language
Laravel 4.0
---
We need your help to finish to translate `validation.php` file with array elements.
You can follow translations in the issue [#73](https://github.com/caouecs/laravel-lang/issues/73).
Laravel 4.1
---
### Password reminder sent
To be ready for the new version of Laravel, we need your help. In `reminders.php` file, a new line has been added :
"sent" => "Password reminder sent!",
You can follow translations in the issue [#137](https://github.com/caouecs/laravel-lang/issues/137).
### Required without all
In `validation.php` file, a new line has been added :
"required_without_all" => "The :attribute field is required when none of :values are present."
You can follow translations in the issue [#172](https://github.com/caouecs/laravel-lang/issues/172).
### Validation email
In `validation.php` file, the text for email has been updated :
"email" => "The :attribute must be a valid email address."
You can follow translations in the issue [#187](https://github.com/caouecs/laravel-lang/issues/187).
### Required with all
In `validation.php` file, a new line has been added :
"required_with_all" => "The :attribute field is required when :values is present."
You can follow translations in the issue [#193](https://github.com/caouecs/laravel-lang/issues/193).
Laravel 4.2
---
### Reset in reminders
In `reminders.php` file, a new line has been added :
"reset" => "Password has been reset!"
You can follow translations in the issue [#258](https://github.com/caouecs/laravel-lang/issues/258).
### Validation.timezone
In `validation.php` file, a new line has been added :
"timezone" => "The :attribute must be a valid zone."
You can follow translations in the issue [#259](https://github.com/caouecs/laravel-lang/issues/259).
Laravel 5.0
---
The files of languages have been updated for Laravel 5, in `laravel5` branch.
* array for PHP 5.4+
* validation.filled, with same translation than validation.required
* *reminders* file is now *languages* file
In `passwords` file [#323](https://github.com/caouecs/laravel-lang/issues/323) :
"sent" => "We have e-mailed your password reset link!"
"reset" => "Your password has been reset!"
-3
View File
@@ -1,3 +0,0 @@
# Security Policy
This project is text translations of Laravel project. So, this project doesn't need to have security policy.
+250
View File
@@ -0,0 +1,250 @@
# Sources
Albanian (sq)
* [Flakerim Ismani](https://github.com/Flakerimi)
Arabic (ar)
* [Ammar Alakkad](https://github.com/AAlakkad)
* [bo3bdo](https://github.com/bo3bdo)
* [Ibrahim AshShohail](https://github.com/laheab)
* [Ihab Shoully](https://github.com/shoully)
* [Youghourta Benali](https://github.com/djug)
Bosnian (bs)
* [Edis Golubić](https://github.com/golubic)
* [mrakodol](https://github.com/mrakodol)
Brazilian (pt-BR)
* [c0h1b4](https://github.com/c0h1b4)
* [Gabriel Machado](https://github.com/gmsantosxl)
* [insign](https://github.com/insign)
* [miguelbgouveia](https://github.com/miguelbgouveia)
* [Ramiro Varandas Jr](https://github.com/ramirovjr)
* [Ricardo Fuhrmann](https://github.com/Fuhrmann)
Bulgarian (bg)
* [Roumen Damianoff](https://github.com/RoumenDamianoff)
* [starstreak](https://github.com/starstreak)
Cambodian (km)
* [Chanthoeun Kim](https://github.com/Chanthoeun)
Catalan (ca)
* [David Moreno](https://github.com/davidmb91)
* [Gerard Nesta](https://github.com/gerardnll)
Chinese (zh-CN)
* [Carlos](https://github.com/overtrue)
* [JohnLui](https://github.com/johnlui)
* [phoenixg](https://github.com/phoenixg)
Chinese from Taiwan (zh-TW)
* [Carlos](https://github.com/overtrue)
Czech (cs)
* [rozklad](https://github.com/rozklad)
Danish (da)
* [Andreas Heiberg](https://github.com/AndreasHeiberg)
* [Christoffer Hauthorn Boisen](https://github.com/hauthorn)
* [Daniel Bøndergaard](https://github.com/danielboendergaard)
Dutch (nl)
* [byordereurope](https://github.com/byordereurope)
* [Herman](https://github.com/sintemaa)
* [Jaspur](https://github.com/jaspur)
* [Jeroen Gerits](https://github.com/jeroengerits)
* [juukie14](https://github.com/juukie14)
* [Mark Mooibroek](https://github.com/markmooibroek)
* [Thomas de Zeeuw](https://github.com/Thomasdezeeuw)
Farsi (fa)
* [Reza](https://github.com/PlangCoder)
Finnish (fi)
* [Linus Odenring](https://github.com/linusodenring)
* [Patrik](https://github.com/gkunno)
French (fr)
* [Alexandre Butynski](https://github.com/alexandre-butynski)
* [Alex-Info.net](https://github.com/AlexInfoNet)
* [Barbuslex](https://github.com/barbuslex)
* [Elyahou](https://github.com/Elyahou)
* [Erwan](https://github.com/NaWer)
* [Fred Delrieu](https://github.com/caouecs)
* [Laravel-France](https://github.com/laravel-france)
* [Youghourta Benali](https://github.com/djug)
German (de)
* [Gerald Lindner](https://github.com/vauteer)
* [iflow](https://github.com/iflow)
* [Jones](https://github.com/JN-Jones)
* [justb81](https://github.com/justb81)
* [lanort](https://github.com/lanort)
* [Marius Gebhardt](https://github.com/gbhrdt)
* [Martin Hettiger](https://github.com/hettiger)
* [nullEuro](https://github.com/nullEuro)
Greek (el)
* [dimsav](https://github.com/dimsav)
* [igaster](https://github.com/igaster)
* [Konstantinos Pittas](https://github.com/kostaspt)
* [Nikos Gr](https://github.com/grrnikos)
Hebrew (he)
* [Orel Ben-Yair](https://github.com/LighTo273)
Hungarian (hu)
* [Tamás Erdélyi](https://github.com/terdelyi)
* [Zsombor Franczia](https://github.com/frzsombor)
Indonesian (id)
* [apit](https://github.com/apit)
* [Budi Irawan](https://github.com/deerawan)
* [Ivo Idham Perdameian](https://github.com/idhamperdameian)
* [William Notowidagdo](https://github.com/williamn)
Italian (it)
* [alextesi](https://github.com/alextesi)
* [Davide Bellini](https://github.com/billmn)
* [Ionut Tanasa](https://github.com/ionut-tanasa)
* [longilineo](https://github.com/longilineo)
Japanese (ja)
* [Hirohisa Kawase](https://github.com/HiroKws)
* [Yuya Takahashi](https://github.com/takahashiyuya)
Korean (ko)
* [dbwhddn10](https://github.com/dbwhddn10)
* [Kaden Lee](https://github.com/thisiskaden)
Lithunian (lt)
* [trigras](https://github.com/trigras)
Macedonian (mk)
* [Marko Aleksic](https://github.com/psybaron)
* [maced0n](https://github.com/maced0n)
Montenegrin (me)
* [Ognjen MIletić](https://github.com/ognjenm)
Norwegian Bokmål (nb)
* [Marius](https://github.com/mariuso)
* [thomeu](https://github.com/thomeu)
Persian (fa)
* [Siamak A.M](https://github.com/blacksrc)
Polish (pl)
* [anojszewski](https://github.com/anojszewski)
* [Jakub Syty](https://github.com/Nekromancer)
* [Marcin Sągol](https://github.com/soee)
Portuguese (pt)
* [Francisco Neves](https://github.com/fntneves)
* [miguelbgouveia](https://github.com/miguelbgouveia)
* [Ramiro Varandas Jr](https://github.com/ramirovjr)
Romanian (ro)
* [flavy](https://github.com/flavy)
* [Ionut Tanasa](https://github.com/ionut-tanasa)
* [Vadim](https://github.com/cojocaru)
Russian (ru)
* [Evgeny Kovalev](https://github.com/EvgenyKovalev)
* [Vasily Tsybenko](https://github.com/VasayXTX)
Sardinian (sa)
* Massimeddu Cireddu
Serbian (sr)
* [Adis](https://github.com/adis-me)
* [Dejan Geci](https://github.com/dejangeci)
Slovak (sk)
* [Andrej Badin](https://github.com/Andreyco)
* [Martin Olšanský](https://github.com/MartinOlsansky)
Spanish (es)
* [Anton Zekeriev Rodin](https://github.com/antonrodin)
* Benjamin Worwa
* [Facundo Farias](https://github.com/facundofarias)
* [Javier Cadiz](https://github.com/cadizjavier)
* [Nikolas](https://github.com/nikoskip)
* [sauralph](https://github.com/sauralph)
Swedish (sv)
* [Alexander Wallin](https://github.com/alexanderwallin)
* [Christoffer Rydberg](https://github.com/murum)
* [coldKingdom](https://github.com/coldKingdom)
* [Jonas Söderberg](https://github.com/imevul)
* [Linus Odenring](https://github.com/linusodenring)
* [Robin Hallabro](https://github.com/hallabro)
* [thomeu](https://github.com/thomeu)
* [Vincent Klaiber](https://github.com/vincentklaiber)
Thai (th)
* [chotikarn](https://github.com/chotikarn)
* [Pachara Limkraisan](https://github.com/kthoth)
* [Teepluss](https://github.com/teepluss)
Traditional Chinese (Hong Kong) (zh-HK)
* [Carlos](https://github.com/overtrue)
* [Eric Li](https://github.com/ericksli)
* [Fatih AYTAÇ](https://github.com/computeus)
Turkish (tr)
* [Arda Kılıçdağı](https://github.com/Ardakilic)
* [azakhi](https://github.com/azakhi)
* [Isa Ishangulyyev](https://github.com/isa424)
* [pellempus](https://github.com/pellempus)
* [Sinan Eldem](https://github.com/sineld)
Turkmen (tk)
* [Isa Ishangulyyev](https://github.com/isa424)
Vietnamese (vi)
* [anhsaker](https://github.com/anhsaker)
* [Nguyễn Văn Ánh](https://github.com/anhskohbo)
+44
View File
@@ -0,0 +1,44 @@
# Status of Languages
| Language | name | v4.0 | v4.1 | required_without_all | val.email | required_with_all | val.boolean | reminders.reset | val.timezone |
|----------|:----:|:----:|:----:|:--------------------:|:---------:|:-----------------:|:-----------:|:---------------:|:------------:|
| Albanian | sq | -- | -- | -- | -- | -- | -- | -- | -- |
| Arabic | ar | OK | OK | OK | OK | OK | OK | OK | OK |
| Bosnian | bs | OK | OK | OK | -- | -- | -- | -- | -- |
| Brazilian | pt-BR | OK | OK | OK | OK | OK | OK | OK | OK |
| Bulgarian | bg | OK | OK | OK | OK | OK | OK | OK | OK |
| Cambodian | km | OK | OK | OK | -- | -- | -- | -- | -- |
| Catalan | ca | OK | OK | OK | OK | OK | OK | OK | OK |
| Chinese | zh-CN | OK | OK | OK | OK | OK | OK | OK | OK |
| Chinese from Taiwan | zh-TW | OK | OK | OK | OK | OK | OK | OK | OK |
| Czech | cs | OK | OK | -- | -- | -- | -- | -- | -- |
| Danish | da | OK | OK | OK | OK | OK | OK | -- | -- |
| Dutch | nl | OK | OK | OK | OK | OK | OK | OK | OK |
| Farsi | fa | OK | OK | OK | OK | OK | -- | -- | -- |
| Finnish | fi | -- | OK | -- | -- | -- | -- | -- | -- |
| French | fr | OK | OK | OK | OK | OK | OK | OK | OK |
| German | de | OK | OK | OK | OK | OK | OK | OK | OK |
| Greek | el | OK | OK | OK | OK | OK | OK | OK | OK |
| Hebrew | he | -- | -- | -- | -- | -- | -- | -- | -- |
| Hungarian | hu | OK | OK | OK | OK | OK | OK | -- | -- |
| Indonesian | id | OK | OK | OK | OK | OK | OK | OK | OK |
| Italian | it | OK | OK | OK | OK | OK | OK | OK | OK |
| Japanese | jp | OK | OK | OK | OK | OK | -- | -- | -- |
| Korean | ko | OK | OK | OK | OK | OK | OK | OK | OK |
| Lithunian | lt | OK | OK | OK | OK | OK | OK | OK | OK |
| Macedonian | mk | OK | OK | -- | -- | -- | -- | -- | -- |
| Montenegrin | me | OK | OK | OK | OK | OK | -- | -- | -- |
| Norwegian Bokmål | nb | OK | OK | -- | -- | -- | -- | -- | -- |
| Polish | pl | OK | OK | -- | -- | -- | -- | -- | -- |
| Portuguese | pt | OK | OK | OK | OK | OK | OK | OK | OK |
| Romanian | ro | OK | OK | OK | -- | -- | -- | -- | -- |
| Russian | ru | OK | OK | OK | OK | OK | OK | OK | OK |
| Serbian | sr | OK | OK | -- | -- | -- | -- | -- | -- |
| Slovak | sk | OK | OK | -- | -- | -- | -- | -- | -- |
| Spanish | es | OK | OK | OK | OK | OK | OK | OK | OK |
| Swedish | sv | OK | OK | OK | OK | OK | OK | OK | OK |
| Thai | th | OK | OK | -- | -- | -- | OK |OK | OK |
| Traditional Chinese (Hong Kong) | zh-HK | OK | OK | OK | OK | OK | OK | OK | OK |
| Turkish | tr | OK | OK | OK | OK | OK | OK | OK | OK |
| Turkmen | tk | OK | OK | OK | OK | OK | OK | OK | OK |
| Vietnamese | vi | OK | OK | OK | OK | OK | OK | OK | OK |
-7
View File
@@ -1,7 +0,0 @@
YANDEX_API_KEY=
YANDEX_API_FOLDER_ID=
GIT_REPOSITORY=origin
GIT_SOURCE_BRANCH=master
GIT_TARGET_BRANCH=patch
GIT_MESSAGE="[%s] Some message"
-3
View File
@@ -1,3 +0,0 @@
requests/
.env
-7
View File
@@ -1,7 +0,0 @@
<?php
use LaravelLang\Lang\Application;
return Application::make(
realpath(__DIR__ . '/../../')
);
-10
View File
@@ -1,10 +0,0 @@
<?php
use LaravelLang\Lang\Processors\Excludes;
require __DIR__ . '/../vendor/autoload.php';
/** @var \LaravelLang\Lang\Application $app */
$app = require_once __DIR__ . '/bootstrap/app.php';
$app->processor(Excludes::make());
-10
View File
@@ -1,10 +0,0 @@
<?php
use LaravelLang\Lang\Processors\Process;
require __DIR__ . '/../vendor/autoload.php';
/** @var \LaravelLang\Lang\Application $app */
$app = require_once __DIR__ . '/bootstrap/app.php';
$app->processor(Process::make());
-87
View File
@@ -1,87 +0,0 @@
<?php
namespace LaravelLang\Lang;
use Dotenv\Dotenv;
use Helldar\Support\Concerns\Makeable;
use LaravelLang\Lang\Contracts\Application as ApplicationContract;
use LaravelLang\Lang\Contracts\Processable;
use LaravelLang\Lang\Facades\Env;
final class Application implements ApplicationContract
{
use Makeable;
public function __construct(
protected string $base_path
) {
$this->createDotenv()->safeLoad();
}
public function basePath(): string
{
return rtrim($this->base_path, '/\\');
}
public function sourcePath(string $filename = null): string
{
return $this->path('source/' . $this->cleanPath($filename));
}
public function localePath(string $locale = null): string
{
return $this->path('locales/' . $this->cleanPath($locale));
}
public function excludePath(string $locale): string
{
return $this->path('excludes/' . $this->cleanPath($locale) . '.php');
}
public function resourcePath(string $filename): string
{
return $this->path('app/resources/' . $this->cleanPath($filename));
}
public function path(string $path = null): string
{
if ($value = $this->cleanPath($path)) {
return $this->basePath() . '/' . $value;
}
return $this->basePath();
}
public function cleanPath(string $path = null): ?string
{
if (! empty($path)) {
return ltrim($path, '/\\');
}
return null;
}
public function processor(Processable $processor): void
{
$processor->application($this)->run();
}
protected function createDotenv(): Dotenv
{
return Dotenv::create(
Env::getRepository(),
$this->environmentPath(),
$this->environmentFile()
);
}
protected function environmentPath(): string
{
return $this->path('app');
}
protected function environmentFile(): string
{
return '.env';
}
}
-43
View File
@@ -1,43 +0,0 @@
<?php
namespace LaravelLang\Lang\Concerns;
use Helldar\Support\Facades\Helpers\Filesystem\Directory;
use Helldar\Support\Facades\Helpers\Str;
use LaravelLang\Lang\Constants\Locales;
trait Contains
{
protected function isMainJson(string $filename): bool
{
if ($this->isEnglishJson($filename)) {
return true;
}
$locale = Str::before($filename, '.');
$path = $this->app->localePath($locale);
return $this->isJson($filename) && Directory::exists($path);
}
protected function isEnglishJson(string $filename): bool
{
return $this->isJson($filename) && str_starts_with($filename, Locales::ENGLISH);
}
protected function isJson(string $filename): bool
{
return str_ends_with($filename, 'json');
}
protected function isMarkdown(string $filename): bool
{
return str_ends_with($filename, 'md');
}
protected function isValidation(string $filename): bool
{
return str_starts_with($filename, 'validation');
}
}
-105
View File
@@ -1,105 +0,0 @@
<?php
namespace LaravelLang\Lang\Concerns;
use Helldar\Support\Facades\Helpers\Digit;
use Helldar\Support\Facades\Helpers\Str;
use LaravelLang\Lang\Services\Counter;
trait Countable
{
protected array $count = [];
protected string $count_prefix = 'count_';
protected string $count_suffix = '_percents';
protected string $count_suffix_all = 'all';
protected function addCount(array $items, string $key = 'all'): void
{
$key = $this->countKeyPrefix($key);
if (! isset($this->count[$key])) {
$this->count[$key] = 0;
}
$this->count[$key] += $this->calcCount($items);
}
protected function getCount(string $key = 'all'): int
{
$key = $this->countKeyPrefix($key);
return $this->count[$key];
}
protected function setCount(int $count, string $key = 'all'): void
{
$key = $this->countKeyPrefix($key);
$this->count[$key] = $count;
}
protected function getCounts(): array
{
$this->calcPercents();
$this->countToString();
return $this->count;
}
protected function calcPercents(): void
{
$all = $this->getCount();
$all_key = $this->countKeyPrefix($this->count_suffix_all);
$items = $this->count;
foreach ($items as $key => $value) {
if ($key !== $all_key) {
$value = $all - $value;
$percent = $this->calcPercent($all, $value);
$new_key = $this->countKeySuffix($key);
$this->setCount($value, $key);
$this->setCount($percent, $new_key);
}
}
}
protected function calcPercent(int $all, int $count): int
{
return round(($count / $all) * 100);
}
protected function countToString(): void
{
foreach ($this->count as &$value) {
$value = $this->countFormat($value);
}
}
protected function calcCount(int|array $value): int
{
return is_int($value) ? $value : Counter::make()->count($value);
}
protected function countKeyPrefix(string $key): string
{
return Str::start($key, $this->count_prefix);
}
protected function countKeySuffix(string $key): string
{
return Str::finish($key, $this->count_suffix);
}
protected function countFormat(int $count): string
{
return Digit::toShort($count);
}
}
-30
View File
@@ -1,30 +0,0 @@
<?php
namespace LaravelLang\Lang\Concerns;
use Helldar\PrettyArray\Services\File as PrettyFile;
use Helldar\Support\Facades\Helpers\Filesystem\File;
/** @mixin \LaravelLang\Lang\Processors\Processor */
trait Excludes
{
protected static array $excludes = [];
protected function hasExclude(string $key, string $locale): bool
{
return in_array($key, $this->getExcludes($locale), true) || in_array($key, $this->getExcludes(), true);
}
protected function getExcludes(string $locale = null): array
{
$locale = $locale ?: '_all';
$path = $this->app->excludePath($locale);
if (static::$excludes[$locale] ?? false) {
return static::$excludes[$locale];
}
return static::$excludes[$locale] = File::exists($path) ? PrettyFile::make()->load($path) : [];
}
}
-39
View File
@@ -1,39 +0,0 @@
<?php
namespace LaravelLang\Lang\Concerns;
use Helldar\Support\Facades\Helpers\Instance;
use Helldar\Support\Tools\Stub;
use LaravelLang\Lang\Contracts\Stringable;
trait Storable
{
protected ?string $stub = null;
protected function prepareToStore(array|string|Stringable $content): string
{
if (Instance::of($content, Stringable::class)) {
return $content->toString();
}
if (is_array($content)) {
return implode(PHP_EOL, $content);
}
return $content;
}
protected function getStub(string $filename): string
{
return $this->findStub($this->stub ?: $filename);
}
protected function findStub(string $filename): string
{
$basename = pathinfo($filename, PATHINFO_FILENAME);
$path = $this->app->resourcePath('arrays/' . $basename . '.stub');
return file_exists($path) ? $path : Stub::PHP_ARRAY;
}
}
-43
View File
@@ -1,43 +0,0 @@
<?php
namespace LaravelLang\Lang\Concerns;
use Helldar\PrettyArray\Services\File;
use Helldar\Support\Facades\Helpers\Str;
trait Template
{
protected static array $templates = [];
protected function template(string $filename, array $values = [], bool $trim = false, bool $return_empty = false): string
{
$template = $this->getTemplate($filename, $trim);
$values = array_merge($this->extend, $values);
return $this->replace($template, $values, $return_empty);
}
protected function replace(string $template, array $values, bool $return_empty = false): string
{
return $return_empty ? '' : Str::replace($template, $values, '{{%s}}');
}
protected function getTemplate(string $filename, bool $trim = false): string
{
if (static::$templates[$filename] ?? false) {
return static::$templates[$filename];
}
$template = File::make()->loadRaw(
$this->templatePath($filename)
);
return static::$templates[$filename] = $trim ? trim($template) : $template;
}
protected function templatePath(string $filename): string
{
return $this->app->resourcePath($filename);
}
}
-8
View File
@@ -1,8 +0,0 @@
<?php
namespace LaravelLang\Lang\Constants;
final class Locales
{
public const ENGLISH = 'en';
}
-45
View File
@@ -1,45 +0,0 @@
<?php
namespace LaravelLang\Lang\Constants;
class Machines
{
public const LOCALES = [
'az',
'be',
'bn',
'bs',
'ca',
'cs',
'cy',
'da',
'et',
'eu',
'fi',
'gl',
'he',
'hi',
'hu',
'is',
'ka',
'kk',
'kn',
'lv',
'mn',
'mr',
'sk',
'sl',
'sq',
'sr_Cyrl',
'sr_Latn',
'sr_Latn_ME',
'sw',
'tg',
'th',
'tl',
'uk',
'ur',
'uz_Cyrl',
'uz_Latn'
];
}
-42
View File
@@ -1,42 +0,0 @@
<?php
namespace LaravelLang\Lang\Constants;
final class Referents
{
public const ar = ['mohamedsabil83', 'Khuthaily'];
public const da = ['jensstigaard'];
public const de = ['WhereIsLucas'];
public const es = ['luisprmat'];
public const fr = ['caouecs', 'WhereIsLucas'];
public const it = ['masterix21'];
public const mk = ['keljtanoski'];
public const nl = ['WhereIsLucas'];
public const pt = ['jorgercosta'];
public const ru = ['andrey-helldar'];
public const sr_Cyrl = ['LukaLatkovic'];
public const sr_Latn = ['LukaLatkovic'];
public const sr_Latn_ME = ['LukaLatkovic'];
public const uk = ['MrAlKuz'];
public const vi = ['dinhquochan'];
public const zh_CN = ['overtrue'];
public const zh_HK = ['overtrue'];
public const zh_TW = ['overtrue'];
}
-28
View File
@@ -1,28 +0,0 @@
<?php
namespace LaravelLang\Lang\Constants;
final class Resource
{
public const STATUS = 'status.stub';
public const LOCALE = 'locale.stub';
public const REFERENTS = 'referents.stub';
public const COMPONENT_ALL_TRANSLATED = 'components/translated.stub';
public const COMPONENT_LINK = 'components/link.stub';
public const COMPONENT_LOCALE = 'components/locale.stub';
public const COMPONENT_TABLE = 'components/table/index.stub';
public const COMPONENT_TABLE_COLUMN = 'components/table/column.stub';
public const COMPONENT_TABLE_ROW = 'components/table/row.stub';
public const COMPONENT_TABLE_ATTRIBUTE_ALIGN = 'components/table/attributes/align.stub';
public const COMPONENT_TABLE_ATTRIBUTE_WIDTH = 'components/table/attributes/width.stub';
}
-24
View File
@@ -1,24 +0,0 @@
<?php
namespace LaravelLang\Lang\Contracts;
interface Application
{
public function __construct(string $base_path);
public function basePath(): string;
public function sourcePath(string $filename = null): string;
public function localePath(string $locale = null): string;
public function excludePath(string $locale): string;
public function resourcePath(string $filename): string;
public function path(string $path = null): string;
public function cleanPath(string $path = null): ?string;
public function processor(Processable $processor): void;
}
-15
View File
@@ -1,15 +0,0 @@
<?php
namespace LaravelLang\Lang\Contracts;
use Helldar\Support\Tools\Stub;
use LaravelLang\Lang\Application;
interface Filesystem
{
public function application(Application $app): self;
public function load(string $path): array;
public function store(string $path, array|string|Stringable $content, bool $is_simple = false, string $stub = Stub::PHP_ARRAY): void;
}
-12
View File
@@ -1,12 +0,0 @@
<?php
namespace LaravelLang\Lang\Contracts;
use LaravelLang\Lang\Application;
interface Processable
{
public function run(): void;
public function application(Application $app): self;
}
-8
View File
@@ -1,8 +0,0 @@
<?php
namespace LaravelLang\Lang\Contracts;
interface Stringable
{
public function toString(): string;
}
-17
View File
@@ -1,17 +0,0 @@
<?php
namespace LaravelLang\Lang\Facades;
use Helldar\Support\Facades\BaseFacade;
use LaravelLang\Lang\Helpers\Arr as Helper;
/**
* @method static array flatten(array $array)
*/
class Arr extends BaseFacade
{
protected static function getFacadeAccessor()
{
return Helper::class;
}
}
-20
View File
@@ -1,20 +0,0 @@
<?php
namespace LaravelLang\Lang\Facades;
use Dotenv\Repository\AdapterRepository;
use Dotenv\Repository\RepositoryInterface;
use Helldar\Support\Facades\BaseFacade;
use LaravelLang\Lang\Support\Env as Support;
/**
* @method static mixed get(string $key, mixed $default = null)
* @method static AdapterRepository|RepositoryInterface getRepository()
*/
class Env extends BaseFacade
{
protected static function getFacadeAccessor()
{
return Support::class;
}
}
-32
View File
@@ -1,32 +0,0 @@
<?php
namespace LaravelLang\Lang\Facades;
use Helldar\Support\Facades\BaseFacade;
use LaravelLang\Lang\Support\Finder;
use LaravelLang\Lang\Support\Package as Support;
use LaravelLang\Lang\Support\Parser;
use Symfony\Component\Finder\Finder as SymfonyFinder;
/**
* @method static Support some()
*/
class Package extends BaseFacade
{
protected static function getFacadeAccessor(): Support
{
return new Support(self::resolveFinder(), self::resolveParser());
}
protected static function resolveFinder(): Finder
{
$finder = SymfonyFinder::create();
return Finder::make($finder);
}
protected static function resolveParser(): Parser
{
return Parser::make();
}
}
-17
View File
@@ -1,17 +0,0 @@
<?php
namespace LaravelLang\Lang\Facades;
use Helldar\Support\Facades\BaseFacade;
use LaravelLang\Lang\Services\Translate as Service;
/**
* @method static string translate(string $locale, string $text)
*/
final class Translate extends BaseFacade
{
protected static function getFacadeAccessor()
{
return Service::class;
}
}
-29
View File
@@ -1,29 +0,0 @@
<?php
namespace LaravelLang\Lang\Helpers;
use Helldar\Support\Facades\Helpers\Str;
class Arr
{
public function flatten(array $array, string|int $key = null): array
{
$result = [];
foreach ($array as $index => $value) {
if (! is_array($value)) {
$new_key = $key ? "$key.$index" : $index;
$result[$new_key] = $value;
continue;
}
$values = $this->flatten($value, $index);
$result = array_merge($result, $values);
}
return $result;
}
}
-47
View File
@@ -1,47 +0,0 @@
<?php
namespace LaravelLang\Lang\Models;
use LaravelLang\Lang\Constants\Machines;
final class Locale extends Model
{
public function __construct(
protected ?string $locale = null,
protected ?int $missing = 0
) {
}
public function getLocale(): ?string
{
return $this->locale;
}
public function getTitle(): ?string
{
if (! $this->isEmpty()) {
$status = $this->getMissing() ? '❗' : '✔';
$machine = $this->hasMachine() ? '&nbsp;🤖' : '';
return $this->locale . '&nbsp;' . $status . $machine;
}
return null;
}
public function getMissing(): ?int
{
return $this->missing;
}
public function isEmpty(): bool
{
return empty($this->locale);
}
protected function hasMachine(): bool
{
return in_array($this->locale, Machines::LOCALES, true);
}
}
-10
View File
@@ -1,10 +0,0 @@
<?php
namespace LaravelLang\Lang\Models;
use Helldar\Support\Concerns\Makeable;
abstract class Model
{
use Makeable;
}
-75
View File
@@ -1,75 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors;
use Helldar\Support\Facades\Helpers\Arr;
use Helldar\Support\Facades\Helpers\Filesystem\File;
final class Excludes extends Processor
{
protected string $target_path = 'excludes';
protected array $keys = [];
protected ?string $stub = 'exclude.stub';
public function run(): void
{
$this->loadKeys();
$this->handle();
}
protected function handle(): void
{
foreach ($this->targetFiles() as $filename) {
$this->process($this->getTargetPath($filename), $filename);
}
}
protected function process(string $target_path, string $filename, string $locale = null): void
{
$target = $this->load($target_path);
$content = $this->merge($this->keys, $target, $filename);
$this->sort($content);
$this->store($target_path, array_values($content), $this->stub, true);
}
protected function merge(array $source, array $target, string $filename): array
{
return array_intersect($source, $target);
}
protected function sort(array &$array): void
{
$array = Arr::sort(array_unique($array));
}
protected function loadKeys(): void
{
foreach ($this->sourceFiles() as $filename) {
$keys = $this->getSourceKeys($filename);
$this->keys = array_merge($this->keys, $keys);
}
}
protected function sourceFiles(): array
{
return File::names($this->getSourcePath(), recursive: true);
}
protected function targetFiles(): array
{
return File::names($this->getTargetPath());
}
protected function getSourceKeys(string $filename): array
{
$items = $this->load($this->getSourcePath($filename));
return array_keys($items);
}
}
-98
View File
@@ -1,98 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors;
use Helldar\Support\Facades\Helpers\Filesystem\Directory;
class Git extends Processor
{
public function run(): void
{
foreach ($this->locales() as $locale) {
dump($locale . '...');
$this->checkout();
$this->createBranch($locale);
$this->add($locale);
$this->commit($locale);
$this->push($locale);
}
}
protected function locales(): array
{
return Directory::names($this->getLocalesPath());
}
protected function checkout(): void
{
$this->git(sprintf('checkout "%s"', $this->getSourceBranchName()));
}
protected function add(string $locale): void
{
$this->git(sprintf('add locales/%s/*', $locale));
}
protected function commit(string $locale): void
{
$message = $this->getMessage($locale);
$this->git(sprintf('commit -m "%s"', $message));
}
protected function push(string $locale): void
{
$repository = env('GIT_REPOSITORY', 'origin');
$branch = $this->getTargetBranchName($locale);
$this->git(sprintf('push --set-upstream %s %s', $repository, $branch));
}
protected function createBranch(string $locale): void
{
$source_branch = $this->getSourceBranchName();
$target_branch = $this->getTargetBranchName($locale);
$this->git(sprintf('checkout -b "%s" "%s"', $target_branch, $source_branch));
}
protected function git(string $command): void
{
$directory = $this->getGitDirectory();
exec('git -C "' . $directory . '" ' . $command);
}
protected function getLocalesPath(): string
{
return $this->app->localePath();
}
protected function getGitDirectory(): string
{
$directory = $this->app->basePath();
return realpath($directory);
}
protected function getSourceBranchName(): string
{
return env('GIT_SOURCE_BRANCH', 'main');
}
protected function getTargetBranchName(string $locale): string
{
$prefix = env('GIT_TARGET_BRANCH', 'patch');
return sprintf('%s/%s/%s', $prefix, date('Y-m-d'), $locale);
}
protected function getMessage(string $locale): string
{
$message = env('GIT_MESSAGE');
return sprintf($message, $locale);
}
}
-46
View File
@@ -1,46 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors;
use Helldar\Support\Facades\Helpers\Arr;
use LaravelLang\Lang\Facades\Package;
final class Packages extends Processor
{
protected array $packages = [
'laravel/fortify' => 'packages/fortify.json',
'laravel/jetstream' => 'packages/jetstream.json',
];
public function run(): void
{
foreach ($this->packages as $package => $filename) {
$items = $this->files($package);
$path = $this->getSourcePath($filename);
$content = $this->map($items);
$this->sort($content);
$this->store($path, $content);
}
}
protected function map(array $items): array
{
return Arr::renameKeys($items, static fn ($key, $value) => $value);
}
protected function files(string $package): array
{
$path = $this->vendorPath($package);
return Package::some()->path($path)->content();
}
protected function vendorPath(string $package): string
{
return $this->app->path('vendor/' . $package);
}
}
-28
View File
@@ -1,28 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors;
use Helldar\Support\Facades\Helpers\Filesystem\File;
final class Process extends Processor
{
protected string $target_path = 'locales';
public function run(): void
{
foreach ($this->locales() as $locale) {
foreach ($this->files($locale) as $file) {
$target_path = $this->getTargetPath($locale . '/' . $file);
$filename = $this->isMainJson($file) ? 'en.json' : $file;
$this->process($target_path, $filename, $locale);
}
}
}
protected function files(string $locale): array
{
return File::names($this->getTargetPath($locale), recursive: true);
}
}
-163
View File
@@ -1,163 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors;
use Helldar\Support\Concerns\Makeable;
use Helldar\Support\Facades\Helpers\Arr;
use Helldar\Support\Facades\Helpers\Filesystem\Directory;
use Helldar\Support\Tools\Stub;
use LaravelLang\Lang\Application;
use LaravelLang\Lang\Concerns\Contains;
use LaravelLang\Lang\Contracts\Filesystem;
use LaravelLang\Lang\Contracts\Processable;
use LaravelLang\Lang\Contracts\Stringable;
use LaravelLang\Lang\Services\Filesystem\Base;
use LaravelLang\Lang\Services\Filesystem\Json as JsonFilesystem;
use LaravelLang\Lang\Services\Filesystem\Markdown as MarkdownFilesystem;
use LaravelLang\Lang\Services\Filesystem\Php as PhpFilesystem;
abstract class Processor implements Processable
{
use Contains;
use Makeable;
protected Application $app;
protected array $source = [];
protected string $target_path;
/** @var \LaravelLang\Lang\Contracts\Filesystem[]|array */
protected array $filesystems = [];
public function application(Application $app): Processable
{
$this->app = $app;
return $this;
}
protected function merge(array $source, array $target, string $filename): array
{
$target = $this->filter($target, $source);
$this->sort($source);
$this->sort($target);
if ($this->isValidation($filename)) {
$custom = $this->getFallbackValue($source, $target, 'custom');
$attributes = $this->getFallbackValue($source, $target, 'attributes');
$source = Arr::except($source, ['custom', 'attributes']);
$target = Arr::except($target, ['custom', 'attributes']);
return array_merge($source, $target, compact('custom', 'attributes'));
}
return array_merge($source, $target);
}
protected function process(string $target_path, string $filename, string $locale = null): void
{
$source = $this->source($filename);
$target = $this->load($target_path);
$content = $this->merge($source, $target, $filename);
$this->store($target_path, $content, $filename);
}
protected function source(string $filename): array
{
if ($this->source[$filename] ?? false) {
return $this->source[$filename];
}
return $this->source[$filename] = $this->load($this->getSourcePath($filename));
}
protected function getFallbackValue(array $source, array $target, string $key)
{
return Arr::get($target, $key) ?: Arr::get($source, $key, []);
}
protected function getTargetPath(string $path = null): string
{
if ($path = $this->app->cleanPath($path)) {
$path = '/' . $path;
}
return $this->app->path($this->target_path . $path);
}
protected function getSourcePath(string $filename = null): string
{
return $this->app->sourcePath($filename);
}
protected function filter(array $first, array $second): array
{
$keys = array_keys($second);
return Arr::only($first, $keys);
}
protected function sort(array &$array): void
{
$array = Arr::ksort($array);
}
protected function load(string $path): array
{
return $this->getFilesystem($path)->load($path);
}
protected function locales(): array
{
return Directory::names($this->getTargetPath());
}
protected function resolveFilename(string $filename, string $locale): string
{
return $this->isMainJson($filename) ? $locale . '.json' : $filename;
}
protected function getFilesystem(string $filename): Filesystem
{
$class = $this->getFilesystemClass($filename);
if ($this->filesystems[$class] ?? false) {
return $this->filesystems[$class];
}
return $this->filesystems[$class] = $this->loadFilesystem($class);
}
protected function getFilesystemClass(string $path): string
{
return match (true) {
$this->isJson($path) => JsonFilesystem::class,
$this->isMarkdown($path) => MarkdownFilesystem::class,
default => PhpFilesystem::class,
};
}
protected function loadFilesystem(Filesystem|Base|string $filesystem): Filesystem
{
return $filesystem::make()->application($this->app);
}
protected function store(string $path, array|string|Stringable $content, string $source_filename = null, bool $is_simple = false): void
{
$stub = $this->getStubPath($source_filename);
$this->getFilesystem($path)->store($path, $content, $is_simple, $stub);
}
protected function getStubPath(?string $filename): ?string
{
return empty($filename) ? Stub::PHP_ARRAY : $filename;
}
}
-51
View File
@@ -1,51 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors;
use Helldar\Support\Facades\Helpers\Filesystem\Directory;
use LaravelLang\Lang\Concerns\Template;
use LaravelLang\Lang\Constants\Referents as Constants;
use LaravelLang\Lang\Contracts\Stringable;
use LaravelLang\Lang\Services\Compilers\Referents as Compilator;
use ReflectionClass;
use ReflectionClassConstant;
final class Referents extends Processor
{
use Template;
protected string $target_path = 'locales';
public function run(): void
{
$map = $this->map();
$result = $this->compileContent($map);
$this->store('docs/referents.md', $result);
}
protected function compileContent(array $items): Stringable
{
return Compilator::make($this->app)->items($items);
}
protected function map(): array
{
$locales = array_flip($this->locales());
return array_merge($locales, $this->assignees());
}
protected function locales(): array
{
return Directory::names($this->getTargetPath());
}
protected function assignees(): array
{
$class = new ReflectionClass(Constants::class);
return $class->getConstants(ReflectionClassConstant::IS_PUBLIC);
}
}
-49
View File
@@ -1,49 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors\Splitters;
use Helldar\Support\Facades\Helpers\Arr;
final class CleanUp extends Processor
{
protected string $target_path = 'locales';
public function run(): void
{
$keys = $this->keys();
foreach ($this->locales() as $locale) {
$path = $this->main($locale);
$items = $this->load($path);
$content = Arr::except($items, $keys);
$this->sort($content);
$this->store($path, $content);
}
}
protected function keys(): array
{
$keys = [];
foreach ($this->files as $file) {
$items = $this->source($file);
$keys = array_merge($keys, $items);
}
return array_keys($keys);
}
protected function locales(): array
{
$locales = parent::locales();
array_push($locales, 'en');
return $locales;
}
}
-29
View File
@@ -1,29 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors\Splitters;
final class Locales extends Processor
{
protected string $target_path = 'locales';
public function run(): void
{
foreach ($this->locales() as $locale) {
$this->handle($locale);
}
}
protected function handle(string $locale)
{
foreach ($this->files as $filename) {
$path = $this->splitTargetPath($locale, $filename);
$this->process($path, $filename, $locale);
}
}
protected function splitTargetPath(string $locale, string $filename): string
{
return $this->getTargetPath($locale . '/' . $filename);
}
}
-13
View File
@@ -1,13 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors\Splitters;
final class Main extends Processor
{
public function run(): void
{
foreach ($this->files as $filename) {
$this->process($this->getSourcePath($filename), $filename);
}
}
}
@@ -1,43 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors\Splitters;
use LaravelLang\Lang\Processors\Processor as BaseProcessor;
abstract class Processor extends BaseProcessor
{
protected array $files = [
'packages/cashier.json',
'packages/fortify.json',
'packages/jetstream.json',
'packages/nova.json',
'packages/spark-paddle.json',
'packages/spark-stripe.json',
];
protected function process(string $target_path, string $filename, string $locale = null): void
{
$main = $this->load($this->main($locale));
$target = $this->load($target_path);
$content = $this->merge($main, $target, $filename);
$this->sort($content);
$this->store($target_path, $content);
}
protected function merge(array $source, array $target, string $filename): array
{
$source = $this->filter($source, $target);
return array_merge($target, $source);
}
protected function main(?string $locale): string
{
return empty($locale) || $locale === 'en'
? $this->getSourcePath('en.json')
: $this->getTargetPath($locale . '/' . $locale . '.json');
}
}
@@ -1,44 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors\Splitters;
use Helldar\Support\Facades\Helpers\Filesystem\Directory;
use Helldar\Support\Facades\Helpers\Filesystem\File;
final class Structure extends Processor
{
protected string $target_path = 'locales';
public function run(): void
{
foreach ($this->locales() as $locale) {
$this->create($locale);
}
}
protected function create(string $locale): void
{
foreach ($this->files as $file) {
$from = $this->getSourcePath($file);
$to = $this->getTargetPath($locale . '/' . $file);
$this->ensureDirectory($to);
if (! $this->fileExists($to)) {
copy($from, $to);
}
}
}
protected function fileExists(string $path): bool
{
return File::exists($path);
}
protected function ensureDirectory(string $path): void
{
$directory = pathinfo($path, PATHINFO_DIRNAME);
Directory::ensureDirectory($directory);
}
}
-52
View File
@@ -1,52 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors\Statuses;
use Helldar\Support\Facades\Helpers\Filesystem\Directory;
use Helldar\Support\Facades\Helpers\Str;
use LaravelLang\Lang\Constants\Resource;
use LaravelLang\Lang\Contracts\Stringable;
use LaravelLang\Lang\Services\Compilers\Collection;
use LaravelLang\Lang\Services\Compilers\Locale;
final class Locales extends Processor
{
protected function saving(): void
{
foreach ($this->locales as $locale => $items) {
$count = $this->countMissing($locale);
$content = $this->compileList($locale, $items);
$result = $this->compileContent($content, $locale, $count);
$filename = Str::slug($locale);
$this->store($this->pathStatus($filename . '.md'), $result);
}
}
protected function compileContent(string $content, string $locale, int $count): Stringable
{
return Locale::make($this->app)->items(compact('locale', 'count', 'content'));
}
protected function compileList(string $locale, array $items): string
{
$content = Collection::make($this->app)
->extend(compact('locale'))
->items($items)
->toString();
return $content ?: $this->template(Resource::COMPONENT_ALL_TRANSLATED);
}
protected function ensureDirectory(): void
{
Directory::ensureDirectory($this->pathStatus(), can_delete: true);
}
protected function pathStatus(string $filename = null): string
{
return $this->app->path('docs/statuses/' . $filename);
}
}
-23
View File
@@ -1,23 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors\Statuses;
use LaravelLang\Lang\Contracts\Stringable;
use LaravelLang\Lang\Services\Compilers\Status;
final class Main extends Processor
{
protected function saving(): void
{
$result = $this->compileContent($this->locales);
$this->store('docs/status.md', $result);
}
protected function compileContent(array $items): Stringable
{
return Status::make($this->app)
->extend($this->getCounts())
->items($items);
}
}
-164
View File
@@ -1,164 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors\Statuses;
use Helldar\Support\Facades\Helpers\Arr;
use Helldar\Support\Facades\Helpers\Filesystem\Directory;
use Helldar\Support\Facades\Helpers\Filesystem\File;
use Helldar\Support\Facades\Tools\Sorter;
use LaravelLang\Lang\Concerns\Countable;
use LaravelLang\Lang\Concerns\Excludes;
use LaravelLang\Lang\Concerns\Template;
use LaravelLang\Lang\Facades\Arr as ArrHelper;
use LaravelLang\Lang\Processors\Processor as BaseProcessor;
abstract class Processor extends BaseProcessor
{
use Countable;
use Excludes;
use Template;
protected string $extension = '.md';
protected string $target_path = 'statuses';
protected array $source_files = [];
protected array $locales = [];
abstract protected function saving(): void;
public function run(): void
{
$this->ensureDirectory();
$this->handle();
$this->saving();
}
protected function handle(): void
{
foreach ($this->locales() as $locale) {
$this->ensureLocale($locale);
foreach ($this->files() as $file) {
$target_path = $this->getTargetPath($locale . $this->extension);
$this->process($target_path, $file, $locale);
}
}
}
protected function process(string $target_path, string $filename, string $locale = null): void
{
$corrected = $this->resolveFilename($filename, $locale);
$source = $this->source($filename);
$target = $this->target($locale, $corrected);
$is_validation = $this->isValidation($filename);
$this->addCount($source);
if ($diff = $this->compare($source, $target, $locale, $is_validation)) {
$this->pushLocale($locale, $corrected, $diff);
$this->addCount($diff, 'diff');
}
}
protected function compare(array $source, array $target, string $locale, bool $is_validation): array
{
$source = $this->prepareComparing($source, $is_validation);
$target = $this->prepareComparing($target, $is_validation);
return array_filter($target,
fn ($value, $key) => $this->hasEquals($value, $key, $source, $locale, $is_validation),
ARRAY_FILTER_USE_BOTH
);
}
protected function prepareComparing(array $array, bool $is_validation): array
{
if ($is_validation) {
$array = Arr::except($array, ['custom', 'attributes']);
}
return ArrHelper::flatten($array);
}
protected function hasEquals($value, $key, array $source, string $locale, bool $is_validation): bool
{
if ($is_validation && in_array($key, ['custom', 'attributes'], true)) {
return false;
}
if ($this->hasExclude($key, $locale)) {
return false;
}
return Arr::get($source, $key) === $value;
}
protected function countMissing(string $locale): int
{
$items = array_map(static fn (array $items) => count($items), $this->locales[$locale]);
return array_sum($items);
}
protected function getLocalePath(string $locale = null): string
{
return $this->app->localePath($locale);
}
protected function locales(): array
{
return Directory::names($this->getLocalePath());
}
protected function files(): array
{
if (! empty($this->source_files)) {
return $this->source_files;
}
$files = File::names($this->getSourcePath(), recursive: true);
$items = Arr::sort($files, function (string $a, string $b) {
$sorter = Sorter::defaultCallback();
return $sorter($a, $b);
});
$php = array_filter($items, fn ($value) => ! $this->isJson($value));
$json = array_filter($items, fn ($value) => $this->isJson($value));
return $this->source_files = array_merge(array_values($php), array_values($json));
}
protected function target(string $locale, string $filename): array
{
$corrected = $this->resolveFilename($filename, $locale);
$path = $this->getLocalePath($locale . '/' . $corrected);
return $this->load($path);
}
protected function pushLocale(string $locale, string $filename, array $diff): void
{
$this->locales[$locale][$filename] = $diff;
}
protected function ensureLocale(string $locale): void
{
if (! isset($this->locales[$locale])) {
$this->locales[$locale] = [];
}
}
protected function ensureDirectory(): void
{
//
}
}
-101
View File
@@ -1,101 +0,0 @@
<?php
namespace LaravelLang\Lang\Processors\Statuses;
use LaravelLang\Lang\Facades\Translate;
use Throwable;
final class Translator extends Processor
{
protected function saving(): void
{
foreach ($this->locales as $locale => $items) {
foreach ($items as $filename => $values) {
dump(sprintf('[%s] %s...', $locale, $filename));
$filename = $this->restoreFilename($locale, $filename);
$this->translateKeys($locale, $filename, $values);
}
}
}
protected function translateKeys(string $locale, string $filename, array $items): void
{
try {
foreach ($items as &$item) {
$item = $this->translate($locale, $item);
}
}
catch (Throwable $e) {
dump($e->getMessage());
}
finally {
$this->storing($locale, $filename, $items);
}
}
protected function storing(string $locale, string $filename, array $items): void
{
$target_path = $this->getLocalePath($locale) . '/' . $filename;
$source = $this->source($filename);
$target = $this->target($locale, $filename);
$target = array_merge($target, $items);
$content = $this->merge($source, $target, $filename);
$this->store($target_path, $content, $filename);
}
protected function translate(string $locale, string $text): string
{
$map = [];
$transformed = $this->transformText($text, $map);
$translated = Translate::translate($locale, $transformed);
return $this->restoreText($translated, $map);
}
protected function transformText(string $text, array &$map): string
{
preg_match_all('/:[a-z]+/', $text, $matches);
foreach ($matches as $match) {
foreach ($match as $key) {
$map[$key] = $this->getRandomValue($map);
}
}
return $this->transformReplace($text, $map);
}
protected function restoreText(string $text, array $map): string
{
return $this->transformReplace($text, array_flip($map));
}
protected function transformReplace(string $text, array $items): string
{
return str_replace(array_keys($items), array_values($items), $text);
}
protected function getRandomValue(array $items): int
{
$random = random_int(1000, 9999);
return in_array($random, $items, true) ? $this->getRandomValue($items) : $random;
}
protected function restoreFilename(string $locale, string $filename): string
{
return match (true) {
$this->isMainJson($filename) => $locale . '.json',
$this->isJson($filename) => $filename . '.json',
default => $filename . '.php',
};
}
}
@@ -1,51 +0,0 @@
<?php
namespace LaravelLang\Lang\Services\Compilers;
use LaravelLang\Lang\Constants\Resource;
final class Collection extends Compiler
{
public function toString(): string
{
$result = '';
foreach ($this->items as $filename => $values) {
$is_json = $this->isJson($filename);
$content = $this->compileItems($values, $is_json);
$count = count($values);
$result .= $this->compileLocale($content, $count, $filename);
}
return $result;
}
protected function compileLocale(string $content, int $count, string $filename): string
{
$basename = $this->basename($filename);
return $this->template(Resource::COMPONENT_LOCALE, compact('count', 'basename', 'filename', 'content'));
}
protected function compileItems(array $items, bool $is_json = false): string
{
$rows = $this->split($items, $is_json);
return Table::make($this->app)->items($rows)->toString();
}
protected function split(array $items, bool $is_json = false): array
{
return $is_json
? array_values(array_map(static fn ($key) => [$key], array_keys($items)))
: array_values(array_map(static fn ($key, $value) => [$key, $value], array_keys($items), array_values($items)));
}
protected function basename(string $filename): string
{
return pathinfo($filename, PATHINFO_FILENAME);
}
}
-39
View File
@@ -1,39 +0,0 @@
<?php
namespace LaravelLang\Lang\Services\Compilers;
use Helldar\Support\Concerns\Makeable;
use LaravelLang\Lang\Concerns\Contains;
use LaravelLang\Lang\Concerns\Template;
use LaravelLang\Lang\Contracts\Application;
use LaravelLang\Lang\Contracts\Stringable;
abstract class Compiler implements Stringable
{
use Contains;
use Makeable;
use Template;
protected array $items;
protected array $extend = [];
public function __construct(
protected Application $app
) {
}
public function items(array $items): self
{
$this->items = $items;
return $this;
}
public function extend(array $values): self
{
$this->extend = $values;
return $this;
}
}
-13
View File
@@ -1,13 +0,0 @@
<?php
namespace LaravelLang\Lang\Services\Compilers;
use LaravelLang\Lang\Constants\Resource;
final class Locale extends Compiler
{
public function toString(): string
{
return $this->template(Resource::LOCALE, $this->items);
}
}
-51
View File
@@ -1,51 +0,0 @@
<?php
namespace LaravelLang\Lang\Services\Compilers;
use LaravelLang\Lang\Constants\Resource;
final class Referents extends Compiler
{
public function toString(): string
{
$content = $this->compileContent();
return $this->template(Resource::REFERENTS, compact('content'));
}
protected function compileContent(): string
{
$rows = [];
foreach ($this->items as $key => $value) {
$rows[] = $this->mapRow($key, $value);
}
return Table::make($this->app)->items($rows)->toString();
}
protected function mapRow(string $key, int|array $values): array
{
$row = [$key, ''];
if (is_array($values)) {
$row[1] = $this->mapAssignees($values);
}
return $row;
}
protected function mapAssignees(array $values): string
{
$result = [];
foreach ($values as $value) {
$result[] = $this->template(Resource::COMPONENT_LINK, [
'title' => '@' . $value,
'link' => 'https://github.com/' . $value,
]);
}
return implode(', ', $result);
}
}
-91
View File
@@ -1,91 +0,0 @@
<?php
namespace LaravelLang\Lang\Services\Compilers;
use Helldar\Support\Facades\Helpers\Str;
use LaravelLang\Lang\Constants\Resource;
use LaravelLang\Lang\Models\Locale;
final class Status extends Compiler
{
protected int $columns = 6;
public function toString(): string
{
return $this->template(Resource::STATUS, $this->getContent());
}
protected function grouped(): array
{
$locales = [];
foreach ($this->items as $locale => $values) {
$missing = count($values);
$locales[] = Locale::make($locale, $missing);
}
return $this->group($locales);
}
protected function group(array $items): array
{
return array_map(function (array $items) {
if (count($items) < $this->columns) {
$need = $this->columns - count($items);
$filled = array_fill(0, $need, Locale::make());
return array_merge($items, $filled);
}
return $items;
}, array_chunk($items, $this->columns));
}
protected function compileContent(): string
{
$rows = [];
foreach ($this->grouped() as $items) {
$rows[] = $this->mapRow($items);
}
return Table::make($this->app)
->items($rows)
->align('center')
->columns($this->columns)
->toString();
}
/**
* @param \LaravelLang\Lang\Models\Locale[]|array $items
*
* @return array
*/
protected function mapRow(array $items): array
{
$row = [];
foreach ($items as $item) {
$row[] = $this->template(Resource::COMPONENT_LINK, [
'title' => $item->getTitle(),
'link' => $this->link($item->getLocale()),
], return_empty: $item->isEmpty());
}
return $row;
}
protected function getContent(): array
{
$content = $this->compileContent();
return array_merge(compact('content'), $this->extend);
}
protected function link(?string $value): string
{
return empty($value) ? '' : sprintf('statuses/%s.md', Str::slug($value));
}
}
-101
View File
@@ -1,101 +0,0 @@
<?php
namespace LaravelLang\Lang\Services\Compilers;
use LaravelLang\Lang\Constants\Resource;
final class Table extends Compiler
{
protected string $align = 'left';
protected int $columns = 1;
public function align(string $align): self
{
$this->align = $align;
return $this;
}
public function columns(int $columns): self
{
$this->columns = $columns;
return $this;
}
public function toString(): string
{
$width = $this->getWidth($this->getTableWidth());
$content = $this->compileRows();
return $this->template(Resource::COMPONENT_TABLE, compact('width', 'content'));
}
protected function compileRows(): string
{
$result = '';
foreach ($this->items as $row) {
$columns = '';
foreach ($row as $value) {
$columns .= $this->compileColumn($value);
}
$result .= $this->compileRow($columns);
}
return $result;
}
protected function compileRow(string $row): string
{
return $this->template(Resource::COMPONENT_TABLE_ROW, compact('row'));
}
protected function compileColumn(string $column): string
{
$align = $this->getAlign();
$width = $this->getWidth($this->getColumnWidth());
return $this->template(Resource::COMPONENT_TABLE_COLUMN, compact('align', 'width', 'column'));
}
protected function getAlign(): string
{
$align = $this->align;
return $this->template(Resource::COMPONENT_TABLE_ATTRIBUTE_ALIGN, compact('align'), true);
}
protected function getWidth(?int $width): ?string
{
if (! $width) {
return null;
}
return $this->template(Resource::COMPONENT_TABLE_ATTRIBUTE_WIDTH, compact('width'), true);
}
protected function getTableWidth(): ?int
{
return $this->hasColumns() ? 100 : null;
}
protected function getColumnWidth(): ?int
{
return $this->hasColumns() ? round(100 / $this->getColumns()) : null;
}
protected function hasColumns(): bool
{
return $this->getColumns() > 1;
}
protected function getColumns(): int
{
return abs($this->columns);
}
}
-26
View File
@@ -1,26 +0,0 @@
<?php
namespace LaravelLang\Lang\Services;
use Helldar\Support\Concerns\Makeable;
final class Counter
{
use Makeable;
protected int $count = 0;
public function count(array $items): int
{
$this->calculate($items);
return $this->count;
}
protected function calculate(array $items): void
{
foreach ($items as $item) {
is_array($item) ? $this->calculate($item) : $this->count++;
}
}
}
-39
View File
@@ -1,39 +0,0 @@
<?php
namespace LaravelLang\Lang\Services\Filesystem;
use Helldar\Support\Concerns\Makeable;
use Helldar\Support\Facades\Helpers\Ables\Arrayable;
use LaravelLang\Lang\Application;
use LaravelLang\Lang\Concerns\Storable;
use LaravelLang\Lang\Contracts\Filesystem;
abstract class Base implements Filesystem
{
use Makeable;
use Storable;
protected Application $app;
public function application(Application $app): Filesystem
{
$this->app = $app;
return $this;
}
public function load(string $path): array
{
return [];
}
protected function correctValues(array $items): array
{
$callback = static fn ($value) => stripslashes($value);
return Arrayable::of($items)
->map($callback, true)
->renameKeys($callback)
->get();
}
}
-29
View File
@@ -1,29 +0,0 @@
<?php
namespace LaravelLang\Lang\Services\Filesystem;
use Helldar\PrettyArray\Services\File as Pretty;
use Helldar\Support\Facades\Helpers\Arr;
use Helldar\Support\Tools\Stub;
use LaravelLang\Lang\Contracts\Stringable;
final class Json extends Base
{
public function load(string $path): array
{
$content = Pretty::make()->loadRaw($path);
$items = json_decode($content, true);
return $this->correctValues($items);
}
public function store(string $path, array|string|Stringable $content, bool $is_simple = false, string $stub = Stub::PHP_ARRAY): void
{
if ($is_simple) {
$content = array_values($content);
}
Arr::storeAsJson($path, $content, false, JSON_UNESCAPED_UNICODE ^ JSON_PRETTY_PRINT);
}
}
-17
View File
@@ -1,17 +0,0 @@
<?php
namespace LaravelLang\Lang\Services\Filesystem;
use Helldar\Support\Facades\Helpers\Filesystem\File;
use Helldar\Support\Tools\Stub;
use LaravelLang\Lang\Contracts\Stringable;
final class Markdown extends Base
{
public function store(string $path, array|string|Stringable $content, bool $is_simple = false, string $stub = Stub::PHP_ARRAY): void
{
$content = $this->prepareToStore($content);
File::store($path, $content);
}
}
-29
View File
@@ -1,29 +0,0 @@
<?php
namespace LaravelLang\Lang\Services\Filesystem;
use Helldar\PrettyArray\Services\File as Pretty;
use Helldar\PrettyArray\Services\Formatter;
use Helldar\Support\Tools\Stub;
use LaravelLang\Lang\Contracts\Stringable;
final class Php extends Base
{
public function load(string $path): array
{
$items = Pretty::make()->load($path);
return $this->correctValues($items);
}
public function store(string $path, array|string|Stringable $content, bool $is_simple = false, string $stub = Stub::PHP_ARRAY): void
{
$service = Formatter::make();
$is_simple
? $service->setSimple()
: $service->setEqualsAlign();
Pretty::make($service->raw($content))->store($path, $this->getStub($stub));
}
}
-67
View File
@@ -1,67 +0,0 @@
<?php
namespace LaravelLang\Lang\Services;
use GuzzleHttp\Client;
use GuzzleHttp\RequestOptions;
use Helldar\Support\Facades\Helpers\Str;
final class Translate
{
protected string $url = 'https://translate.api.cloud.yandex.net/translate/v2/translate';
public function translate(string $locale, string $text): string
{
$content = $this->request($locale, $text);
return $content['translations'][0]['text'];
}
protected function request(string $locale, string $text): array
{
$response = $this->client()->request('POST', $this->url, [
RequestOptions::HEADERS => $this->headers(),
RequestOptions::JSON => $this->body($locale, $text),
]);
return json_decode($response->getBody()->getContents(), true);
}
protected function headers(): array
{
return [
'Authorization' => 'Bearer ' . $this->apiKey(),
];
}
protected function body(string $locale, string $text): array
{
return [
'targetLanguageCode' => $this->correctLocale($locale),
'texts' => [$text],
'folderId' => $this->folderId(),
];
}
protected function correctLocale(string $locale): string
{
return Str::before($locale, '_');
}
protected function client(): Client
{
return new Client();
}
protected function apiKey(): string
{
return env('YANDEX_API_KEY');
}
protected function folderId(): string
{
return env('YANDEX_API_FOLDER_ID');
}
}
-31
View File
@@ -1,31 +0,0 @@
<?php
namespace LaravelLang\Lang\Support;
use Dotenv\Repository\AdapterRepository;
use Dotenv\Repository\RepositoryBuilder;
use Dotenv\Repository\RepositoryInterface;
use PhpOption\Option;
final class Env
{
protected static RepositoryInterface|AdapterRepository|null $repository;
public function get(string $key, mixed $default = null): mixed
{
$value = $this->getRepository()->get($key);
return Option::fromValue($value)->getOrElse($default);
}
public function getRepository(): AdapterRepository|RepositoryInterface
{
if (self::$repository ?? false) {
return self::$repository;
}
$builder = RepositoryBuilder::createWithDefaultAdapters();
return self::$repository = $builder->immutable()->make();
}
}
-53
View File
@@ -1,53 +0,0 @@
<?php
namespace LaravelLang\Lang\Support;
use Helldar\Support\Concerns\Makeable;
use Symfony\Component\Finder\Finder as SymfonyFinder;
class Finder
{
use Makeable;
protected array $names = ['*.php', '*.json', '*.js', '*.vue'];
protected array $contains = ['__(', 'trans(', '@lang(', 'Lang::get('];
protected array $files = [];
public function __construct(
protected SymfonyFinder $instance
) {
}
public function get(string|array $path): array
{
$this->search($path);
return $this->files();
}
protected function search(string|array $path): void
{
foreach ($this->find($path) as $file) {
$this->push($file->getRealPath());
}
}
protected function find(string|array $path): SymfonyFinder
{
return $this->instance->in($path)->files()
->name($this->names)
->contains($this->contains);
}
protected function push(string $path): void
{
$this->files[] = $path;
}
protected function files(): array
{
return $this->files;
}
}
-57
View File
@@ -1,57 +0,0 @@
<?php
namespace LaravelLang\Lang\Support;
use Helldar\Support\Facades\Helpers\Filesystem\Directory;
use Helldar\Support\Facades\Helpers\Str;
class Package
{
protected ?string $path;
protected array $filter = ['$this', 'self::', 'auth.', 'pagination.', 'passwords.', 'validation.'];
public function __construct(
protected Finder $finder,
protected Parser $parser
) {
}
public function some(): self
{
return $this;
}
public function path(string $path): self
{
Directory::validate($path);
$this->path = realpath($path);
return $this;
}
public function content(): array
{
$files = $this->files();
$items = $this->parsed($files);
return $this->filter($items);
}
protected function files(): array
{
return $this->finder->get($this->path);
}
protected function parsed(array $files): array
{
return $this->parser->files($files)->get();
}
protected function filter(array $items): array
{
return array_filter(array_keys($items), fn ($value) => ! Str::startsWith($value, $this->filter));
}
}
-97
View File
@@ -1,97 +0,0 @@
<?php
namespace LaravelLang\Lang\Support;
use Helldar\Support\Concerns\Makeable;
use Helldar\Support\Facades\Helpers\Arr;
use Helldar\Support\Facades\Helpers\Str;
class Parser
{
use Makeable;
protected const REGEX = '/\b(__|trans|@lang|Lang\:\:get)\((.+)(\)|,\s?\[)/U';
protected array $files = [];
protected array $keys = [];
public function files(array $files): self
{
$this->files = $files;
return $this;
}
public function get(): array
{
$this->each();
$this->sort();
return $this->keys();
}
protected function each(): void
{
foreach ($this->files as $file) {
$content = file_get_contents($file);
$this->parse($content);
}
}
protected function sort(): void
{
Arr::ksort($this->keys);
}
protected function parse(string $content): void
{
foreach ($this->match($content) as $match) {
$value = $match;
if (Str::contains((string) $value, ['__', 'trans', '@lang', 'Lang::get'])) {
$sub_key = $this->subkey($value);
$value = $this->keys[$sub_key] ?? null;
}
$this->push($value);
}
}
protected function match(string $content, string $pattern = self::REGEX): array
{
preg_match_all($pattern, $content, $matches);
return $matches[2] ?? [];
}
protected function push(mixed $value): void
{
$value = $this->trim($value);
if (! isset($this->keys[$value])) {
$this->keys[$value] = $value;
}
}
protected function subkey(string $value): string
{
$sub_key = $this->match($value)[0];
return $this->trim($sub_key);
}
protected function keys(): array
{
return $this->keys;
}
protected function trim($value)
{
$chars = " \t\n\r\0\x0B'\"";
return is_string($value) ? trim($value, $chars) : $value;
}
}
-18
View File
@@ -1,18 +0,0 @@
<?php
use LaravelLang\Lang\Facades\Env;
if (! function_exists('env')) {
/**
* Determine if the given value is "blank".
*
* @param string $key
* @param mixed|null $default
*
* @return bool
*/
function env(string $key, mixed $default = null): mixed
{
return Env::get($key, $default);
}
}
-10
View File
@@ -1,10 +0,0 @@
<?php
use LaravelLang\Lang\Processors\Packages;
require __DIR__ . '/../vendor/autoload.php';
/** @var \LaravelLang\Lang\Application $app */
$app = require_once __DIR__ . '/bootstrap/app.php';
$app->processor(Packages::make());
-10
View File
@@ -1,10 +0,0 @@
<?php
use LaravelLang\Lang\Processors\Git;
require __DIR__ . '/../vendor/autoload.php';
/** @var \LaravelLang\Lang\Application $app */
$app = require_once __DIR__ . '/bootstrap/app.php';
$app->processor(Git::make());
-10
View File
@@ -1,10 +0,0 @@
<?php
use LaravelLang\Lang\Processors\Referents;
require __DIR__ . '/../vendor/autoload.php';
/** @var \LaravelLang\Lang\Application $app */
$app = require_once __DIR__ . '/bootstrap/app.php';
$app->processor(Referents::make());
-14
View File
@@ -1,14 +0,0 @@
<?php
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
return {{slot}};
-13
View File
@@ -1,13 +0,0 @@
<?php
/*
|--------------------------------------------------------------------------
| Exclusion list
|--------------------------------------------------------------------------
|
| This is a list of exclusions for words or phrases where the original
| form of the word has the same spelling in a given language.
|
*/
return {{slot}};
-14
View File
@@ -1,14 +0,0 @@
<?php
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
return {{slot}};
-14
View File
@@ -1,14 +0,0 @@
<?php
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
return {{slot}};
@@ -1,14 +0,0 @@
<?php
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
return {{slot}};
-14
View File
@@ -1,14 +0,0 @@
<?php
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
return {{slot}};
-2
View File
@@ -1,2 +0,0 @@
[{{title}}]({{link}})
-8
View File
@@ -1,8 +0,0 @@
### [{{basename}}](https://github.com/Laravel-Lang/lang/blob/master/locales/{{locale}}/{{filename}})
##### Missing: {{count}}
{{content}}
[ [go back](../status.md) | [to top](#) ]
@@ -1 +0,0 @@
align="{{align}}"
@@ -1 +0,0 @@
width="{{width}}%"
@@ -1,3 +0,0 @@
<td {{align}} {{width}}>
{{column}}
</td>
@@ -1,3 +0,0 @@
<table {{width}}>
{{content}}
</table>
-1
View File
@@ -1 +0,0 @@
<tr>{{row}}</tr>
-1
View File
@@ -1 +0,0 @@
All lines are translated 😊
-7
View File
@@ -1,7 +0,0 @@
[Laravel Lang](https://github.com/Laravel-Lang/lang) / [Main Page](../index.md) / [Completion Status](../status.md) / {{locale}}
# {{locale}}
##### All missed: {{count}}
{{content}}
-7
View File
@@ -1,7 +0,0 @@
[Laravel Lang](https://github.com/Laravel-Lang/lang) / [Main Page](index.md) / Referents by language
# Referents by language
{{content}}
[ [to top](#) ]
-7
View File
@@ -1,7 +0,0 @@
[Laravel Lang](https://github.com/Laravel-Lang/lang) / [Main Page](index.md) / Completion Status
# Completion status
> Translation of localizations is completed by **{{count_diff_percents}}%** ({{count_diff}} / {{count_all}}).
{{content}}
-15
View File
@@ -1,15 +0,0 @@
<?php
use LaravelLang\Lang\Processors\Packages;
use LaravelLang\Lang\Processors\Splitters\{CleanUp, Locales, Main, Structure};
require __DIR__ . '/../vendor/autoload.php';
/** @var \LaravelLang\Lang\Application $app */
$app = require_once __DIR__ . '/bootstrap/app.php';
$app->processor(Packages::make());
$app->processor(Structure::make());
$app->processor(Main::make());
$app->processor(Locales::make());
$app->processor(CleanUp::make());
-12
View File
@@ -1,12 +0,0 @@
<?php
use LaravelLang\Lang\Processors\Statuses\Locales;
use LaravelLang\Lang\Processors\Statuses\Main;
require __DIR__ . '/../vendor/autoload.php';
/** @var \LaravelLang\Lang\Application $app */
$app = require_once __DIR__ . '/bootstrap/app.php';
$app->processor(Main::make());
$app->processor(Locales::make());
-26
View File
@@ -1,26 +0,0 @@
<?php
namespace Tests\Concerns;
trait Messages
{
protected function messageAssertSee(string $path, string $content): string
{
return sprintf('String "%s" was not found in file %s', $content, realpath($path));
}
protected function messageAssertDoesntSee(string $path, string $content): string
{
return sprintf('String "%s" was found in file %s', $content, realpath($path));
}
protected function messageForPath(string $path): string
{
return sprintf('Problem found in file: %s', realpath($path));
}
protected function messageForLocale(string $path, string $locale): string
{
return sprintf('Found a problem with localization of "%s" in file %s', realpath($path), $locale);
}
}
-41
View File
@@ -1,41 +0,0 @@
<?php
namespace Tests;
use Helldar\PrettyArray\Services\File as Pretty;
final class JsonTest extends TestCase
{
public function testJson(): void
{
foreach ($this->files('.json') as $filename) {
$resolved = $this->resolveFilename($filename);
$source = $this->source($resolved);
foreach ($this->locales() as $locale) {
$filename = $this->resolveFilename($filename, $locale);
$path = $this->target_path . '/' . $locale . '/' . $filename;
$target = $this->load($path);
$this->assertSame(array_keys($source), array_keys($target), $this->messageForPath($path));
}
}
}
protected function load(string $path): array
{
$content = Pretty::make()->loadRaw($path);
$items = json_decode($content, true);
return $this->correctValues($items);
}
protected function resolveFilename(string $filename, string $locale = null): string
{
return $this->isMainJson($filename) && ! empty($locale) ? $locale . '.json' : $filename;
}
}
-34
View File
@@ -1,34 +0,0 @@
<?php
namespace Tests;
use Helldar\PrettyArray\Services\File as Pretty;
final class PhpTest extends TestCase
{
public function testPhp(): void
{
foreach ($this->files('.php') as $filename) {
$source = $this->source($filename);
foreach ($this->locales() as $locale) {
$path = $this->target_path . '/' . $locale . '/' . $filename;
$target = $this->load($path);
$this->assertSame(array_keys($source), array_keys($target), $this->messageForLocale($path, $locale));
if ($this->isInline($filename)) {
$this->assertDoesntSee($path, [':attribute', ':Attribute']);
}
}
}
}
protected function load(string $path): array
{
$items = Pretty::make()->load($path);
return $this->correctValues($items);
}
}
-41
View File
@@ -1,41 +0,0 @@
<?php
namespace Tests;
use Helldar\Support\Facades\Helpers\Filesystem\Directory;
use Helldar\Support\Facades\Helpers\Str;
class StatusLocalesTest extends TestCase
{
protected string $source_path = __DIR__ . '/../../locales';
protected string $target_path = __DIR__ . '/../../docs/statuses';
public function testSee(): void
{
foreach ($this->locales() as $locale) {
$path = $this->path($locale);
$this->assertFileExists($path);
$this->assertSee($path, '# ' . Str::before($locale, '.'));
$this->assertSee($path, '##### All missed:');
$this->assertDoesntSee($path, '## foo');
$this->assertDoesntSee($path, '## bar');
$this->assertDoesntSee($path, '## baz');
}
}
protected function locales(): array
{
return Directory::names($this->source_path);
}
protected function path(string $filename): string
{
$filename = Str::slug($filename);
return $this->target_path . '/' . $filename . '.md';
}
}
-43
View File
@@ -1,43 +0,0 @@
<?php
namespace Tests;
use Helldar\Support\Facades\Helpers\Filesystem\Directory;
use Helldar\Support\Facades\Helpers\Str;
final class StatusTest extends TestCase
{
protected string $target_path = __DIR__ . '/../../locales';
protected string $status = __DIR__ . '/../../docs/status.md';
public function testSee(): void
{
foreach ($this->locales() as $locale) {
$slug = Str::slug($locale);
$this->assertSee($this->status, "{$locale}&nbsp;");
$this->assertSee($this->status, "(statuses/{$slug}.md)");
}
}
public function testDoesntSee(): void
{
$this->assertDoesntSee($this->status, '## foo');
$this->assertDoesntSee($this->status, '## bar');
$this->assertDoesntSee($this->status, '## baz');
$this->assertDoesntSee($this->status, '(statuses/foo.md)');
$this->assertDoesntSee($this->status, '(statuses/bar.md)');
$this->assertDoesntSee($this->status, '(statuses/baz.md)');
$this->assertDoesntSee($this->status, '(todo/foo.md)');
$this->assertDoesntSee($this->status, '(todo/bar.md)');
$this->assertDoesntSee($this->status, '(todo/baz.md)');
}
protected function locales(): array
{
return Directory::names($this->target_path);
}
}
-115
View File
@@ -1,115 +0,0 @@
<?php
namespace Tests;
use Helldar\PrettyArray\Services\File;
use Helldar\Support\Facades\Helpers\Ables\Arrayable;
use Helldar\Support\Facades\Helpers\Arr;
use Helldar\Support\Facades\Helpers\Filesystem\Directory;
use Helldar\Support\Facades\Helpers\Filesystem\File as Filesystem;
use Helldar\Support\Facades\Helpers\Str;
use LaravelLang\Lang\Constants\Locales;
use PHPUnit\Framework\TestCase as BaseTestCase;
use Tests\Concerns\Messages;
abstract class TestCase extends BaseTestCase
{
use Messages;
protected string $source_path = __DIR__ . '/../../source';
protected string $target_path = __DIR__ . '/../../locales';
protected function source(string $filename): array
{
$content = $this->load($this->source_path . '/' . $filename);
if ($this->isValidation($filename)) {
$custom = Arr::get($content, 'custom', []);
$attributes = Arr::get($content, 'attributes', []);
return Arrayable::of($content)
->except(['custom', 'attributes'])
->ksort()
->merge(compact('custom', 'attributes'))
->get();
}
return Arr::ksort($content);
}
protected function assertSee(string $path, string $content): void
{
$file = File::make()->loadRaw($path);
$this->assertTrue(
str_contains($file, $content),
$this->messageAssertSee($path, $content)
);
}
protected function assertDoesntSee(string $path, string|array $content): void
{
$file = File::make()->loadRaw($path);
$values = Arr::wrap($content);
foreach ($values as $value) {
$this->assertFalse(
str_contains($file, $value),
$this->messageAssertDoesntSee($path, $value)
);
}
}
protected function sort(array &$array): void
{
$array = Arr::ksort($array);
}
protected function files(string $extension): array
{
return Filesystem::names($this->source_path, static fn ($filename) => str_ends_with($filename, $extension), recursive: true);
}
protected function locales(): array
{
return Directory::names($this->target_path);
}
protected function isValidation(string $filename): bool
{
return str_starts_with($filename, 'validation');
}
protected function isInline(string $filename): bool
{
return str_contains($filename, 'inline');
}
protected function isMainJson(string $filename): bool
{
if ($this->isEnglish($filename)) {
return true;
}
$locale = Str::before($filename, '.');
return Directory::exists(__DIR__ . '/../../locales/' . $locale);
}
protected function isEnglish(string $filename): bool
{
return str_starts_with($filename, Locales::ENGLISH);
}
protected function correctValues(array $items): array
{
$callback = static fn ($value) => stripslashes($value);
return Arrayable::of($items)
->map($callback, true)
->renameKeys($callback)
->get();
}
}
-10
View File
@@ -1,10 +0,0 @@
<?php
use LaravelLang\Lang\Processors\Statuses\Translator;
require __DIR__ . '/../vendor/autoload.php';
/** @var \LaravelLang\Lang\Application $app */
$app = require_once __DIR__ . '/bootstrap/app.php';
$app->processor(Translator::make());
+20
View File
@@ -0,0 +1,20 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => '&laquo; السابق',
'next' => 'التالي &raquo;',
);
Loaded 100 of 1287 files, more files were not shown because too many files have changed in this diff. Show more