Giter Club home page Giter Club logo

localisation's Introduction

Localisation

Codacy Badge StyleCI License Total Downloads Latest Stable Version

Localisation management dependency for Laravel Enso.

This package works exclusively within the Enso ecosystem.

The front end assets that utilize this api are present in the ui package.

For live examples and demos, you may visit laravel-enso.com

Screenshot

Watch the demo click on the photo to view a short demo in compatible browsers

Installation, Configuration & Usage

Be sure to check out the full documentation for this package available at docs.laravel-enso.com

Contributions

are welcome. Pull requests are great, but issues are good too.

License

This package is released under the MIT license.

localisation's People

Contributors

abdullahiabdulkabir avatar aocneanu avatar b-stavitskiy avatar dahabit avatar franlmsp avatar gandesc avatar gitmanuela avatar guastallaigor avatar jlsjonas avatar llevering avatar mauthi avatar pongraczi avatar raftx24 avatar shapito27 avatar shonhor22 avatar vmcvlad avatar y0net avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

localisation's Issues

Testresults: Add ability to split enso translations and own translations

Add lang

  • OK
  • New core files are empty - I think this is OK?

Update lang (change shortcode) xx > xy

  • Not OK
  • /lang/xx.json gets renamed to xy.json
  • /lang/enso/xx.json stays xx.json
  • /lang/app/xx.json stays xx.json
  • fixed in my PR #26

Delete lang

  • OK

Update lang file in package and publish changes

  • Changes in Core are not published automatically.
  • We should add php artisan vendor:publish --force --tag='localisation-lang-files' to php artisan vendor:publish --force --tag='enso-assets' (but publish enso lang files only, not core lang files)
  • added the change to my PR #26
  • Needed Change: Add php artisan localisation:merge to composer post-update-cmd

Merge translations

  • Message was wrong Language files merged ("")! because of protected $signature = 'localisation:merge {--L|locale="" : Language key to merge (default: all)}'; sends "" as string.
  • Changed signature to protected $signature = 'localisation:merge {--L|locale= : Language key to merge (default: all)}';
  • added the change to my PR #26

Add translation key (core and app)

  • OK

Remove translation key (core and app)

  • OK

Change translation (core and app)

  • OK

Test collectMissingKeys on/off (frontend / core = true, core = false)

  • OK

Feature request: can we store files with line breaks in enso and app dir because it makes it easery to compare files and merge PRs - in the merged file it's ok to store them without line breaks.

  • added the change to my PR #26

Question: Should the state of Key collector get stored locally? At the moment its Off after every reload?

Language not set in Laravel session?

This is a bug | feature request. (I consider it a bug as it's implied to be using Laravel's methods)

Prerequisites

  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you check the documentation?
  • Did you perform a cursory search?

Description

It seems that using __() in php doesn't cause the translation to appear; but instead the original (english) key.

I've checked the docs and the new system does match with Laravel's expectancy, so it should just be the setLocale() that's missing

Steps to Reproduce

  1. Try to translate a string (using __(...) from within php (for example in a Form controller)
  2. Ensure your language is different from English AND the key used above is defined
  3. Note the english (key) version is kept.

Expected behavior

Translated text to appear

Actual behavior

orginal (key) shown instead

Toastr title not translated on login screen

This is a bug.

Description

Toastr title not translated on login screen

Steps to Reproduce

Go to login screen
Enter invalid data
Click button

Expected behavior

Title of error badge should be translated

Actual behavior

Title of error badge is not translated

screenshot 2018-03-29 08 14 46
screenshot 2018-03-29 08 11 05

Language of login page

Do you know how the language of login page is selected?
It should be taken from browser language, but for me it's english instead of german.

Same for mails (e.g. password forgotten)

do not allow the deletion of an active language

Do not allow the deletion of an active language, for the user currently making the change.
Also, handle updating the active language for all users of the application, if that language is deleted.

Support filtering on translation values in editTexts

This is a feature request.

Prerequisites

  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you check the documentation?
  • Did you perform a cursory search?

Description

It would be really useful if the editTexts search feature allowed searching on value alongside key

Use Case

Noticing a bad translation; requiring to look up in the code where it's generated to (in most cases it's the more secluded items that have bad translations, so just toggling language isn't a solution in those cases + they're often reported in the field (and they just have a globally set language + can't be asked for that info)

Remarks

I noticed key-based filtering is embedded quite deeply (likely due to the missing-key logic; which is a great feature too!) if you have an implementation method idea that wouldn't cause a big hit on performance I'm definitely willing to PR this.

Translate time info in notifications

This is a feature request.

Description

See screenshot

At the moment the time info in notifications is not translated.
Be aware that we have different possibilities here:

  • lass than a minute
  • xx minutes
  • ...

Steps to Reproduce

Login
Request a new export
run php artisan queue:work

Expected behavior

Time info should be translated

Actual behavior

Time info is in EN

Support parameters in keys

This is a feature request.

Prerequisites

  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you check the documentation?
  • Did you perform a cursory search?

Description

Expanding the FE translation (__) api to also support parameters (as documented by Laravel)

Use Case example

Several sentences are formed differently in different languages, having simple parameters in the string allows the translator to choose the order without requiring weird programming logic

ex.: when describing "something happened at ", in German the date usually comes first.
There are more useful uses too though; like having a status mid-sentence (without requiring 2 weird keys to make up the sentence)

Localisation of login/password reset

This is a question.

Prerequisites

  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you check the documentation?
  • Did you perform a cursory search?

Description

I have 2 questions

  • How can I set the language of login screen (I changed it in local and vendor preferences.json but this did not change anything - I also deleted preferences table and app cache first) (btw: Setting default theme is also not working)
  • How can I set the translations for toastr messages on password reset screen (they are set in the json file and in lang/de/passwords - but both keys are not used and I get an empty toastr)

Don't get 2.3.7 on composer update

This is a bug.

Description

Package is required with:
"laravel-enso/localisation": "2.3.*",

After composer update I geht the following version

"name": "laravel-enso/localisation",
 "version": "2.3.6",

Refactor

This is a feature request.

Prerequisites

  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you check the documentation?
  • Did you perform a cursory search?

Description

We need a micro-refactor for this package which aims to:

  • update the language resources
  • fix some bugs found when adding keys
  • rename localisation-lang-files tag into enso-localisation
  • modify AppServiceProvider in order to publish language resources that are not contained in app or enso directories.
  • verify if there are some missing keys among localisation files
  • delete empty localisation files from app directory
  • save local translations to app directory when adding or updating
  • save core translations to package enso directory when adding or updating
  • enso resource directory will be removed from local resources
  • local app localization resource files will be merged with the existing package localization resource files under enso directory

Add ability to split enso translations and own translations

Use case:
I added own translation keys via frontend which are stored in assests/lang/xx.json. In the same file there are the enso translations too.
If you deploy a new version with new translations I have to merge those files.

It would be better if it would be possible to split translations into groups which are stored in different files.
assests/lang/enso/xx.json
assests/lang/mauthi/xx.json
...

Document title not translated after reload

This is a bug.

Description

After reload of browser window the document title is not translated

Steps to Reproduce

Open enso and reload page

Expected behavior

screenshot 2018-03-26 22 30 02

Actual behavior

screenshot 2018-03-26 22 29 53

system.localisation.merge 404 exception

This is a bug.

Prerequisites

  • [ * ] Are you running the latest version?
  • [ * ] Are you reporting to the correct repository?
  • [ * ] Did you check the documentation?
  • [ * ] Did you perform a cursory search?

Description

Route system.localisation.merge, called by button "Merge all localisation files" - give 404 error.

You use routes that contains only required parameters, like:
Route::patch('{localisation}', 'Update')->name('update');

Laravel match routes by:

  1. method
  2. url

We have 2 routes with same method:

  1. Route::patch('{localisation}', 'Update')->name('update');
  2. Route::patch('merge/{locale?}', 'Merge')->name('merge');
    Since expected url for №1 is api/system/localisation/* and this route is located before №2, laravel will never reach №2 route AND since №1 has required parameter - generates NotFoundHttpException exception.

Steps to Reproduce

  1. Open /system/localisation/editTexts route
  2. Press "Merge all localisation files" button

Expected behavior

Success message

Actual behavior

NotFoundHttpException exception

Update Tests

The cleanup and assertions need to be updated for the new structure

Datatable not translated

Do you have an idea why my datatable is not translated (not in default tables too, e.g. users)

screenshot 2018-03-24 14 56 53

Datepicker in Form: Select Date not translated

This is a bug.

Description

The Select Date in datepicker is not translated, even if we add it as key

Steps to Reproduce

Create a form with datepicker

Expected behavior

Select Date should be replaced with translated value

Actual behavior

Select Date is not replaced with translated value

can_store_language expects deleted files

This is a bug.

Prerequisites

  • Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you check the documentation?
  • Did you perform a cursory search?

Description

Json\Storer expects app/<lang>.json & enso/<lang>.json files to exist.
However, these files, even if present, are being automatically deleted since 544b399

Steps to Reproduce

  1. run localisation's can_store_language test

Expected behavior

tests to pass

Actual behavior

expects files to be present that are getting deleted in the test cleanup, reproducible across windows (10) & Linux (CentOS)

[bug] Remove key from lang files

This is a bug.

Prerequisites

  • [x ] Are you running the latest version?
  • Are you reporting to the correct repository?
  • Did you check the documentation?
  • Did you perform a cursory search?

Description

When we remove a key from the UI it gets deleted only from the language we edit.

Steps to Reproduce

Expected behavior

The key should be removed from all lang files

Actual behavior

The key is removed only from the lang file corresponding to the edited language in UI

Errors on login page (in 2.5.5)

This is a bug | feature request

Prerequisites

  • [ x ] Are you running the latest version?
  • [ x ] Are you reporting to the correct repository?
  • [ x ] Did you check the documentation?
  • [ x ] Did you perform a cursory search?

Description

2 Errors on login page after update

  • placeholder wrong
  • console errors

Steps to Reproduce

Update to 2.5.5. and go to login page

Expected behavior

Actual behavior

see Screenshots

screenshot 2018-03-28 18 09 16
screenshot 2018-03-28 18 09 09

Error exception when trying to publish assets

There is an error when trying to publish assets from enso-core.

Here is an screenshot and a log of the error:

170620103037

[2017-06-20 10:20:36] local.ERROR: ErrorException: include(S:\Code\Laravel\enso-test\resources\lang/en/en\auth.php): failed to open stream: No such file or directory in S:\Code\Laravel\enso-test\vendor\laravel-enso\localisation\src\app\Classes\LangFilesManager.php:64
Stack trace:
#0 S:\Code\Laravel\enso-test\vendor\laravel-enso\localisation\src\app\Classes\LangFilesManager.php(64): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'include(S:\Code...', 'S:\Code\Laravel...', 64, Array)
#1 S:\Code\Laravel\enso-test\vendor\laravel-enso\localisation\src\app\Classes\LangFilesManager.php(64): include()
#2 S:\Code\Laravel\enso-test\vendor\laravel-enso\localisation\src\app\Classes\LangFilesManager.php(55): LaravelEnso\Localisation\app\Classes\LangFilesManager->getFileContent('en\auth.php')
#3 S:\Code\Laravel\enso-test\vendor\laravel-enso\localisation\src\app\Classes\LangFilesManager.php(47): LaravelEnso\Localisation\app\Classes\LangFilesManager->getTranslationsFromFile('en\auth.php')
#4 S:\Code\Laravel\enso-test\vendor\laravel-enso\localisation\src\app\Classes\LangFilesManager.php(17): LaravelEnso\Localisation\app\Classes\LangFilesManager->getTranslations()
#5 S:\Code\Laravel\enso-test\vendor\laravel-enso\localisation\src\app\Commands\Generate.php(24): LaravelEnso\Localisation\app\Classes\LangFilesManager->__construct('en')
#6 [internal function]: LaravelEnso\Localisation\app\Commands\Generate->__construct()
#7 S:\Code\Laravel\enso-test\vendor\laravel\framework\src\Illuminate\Container\Container.php(762): ReflectionClass->newInstanceArgs(Array)
#8 S:\Code\Laravel\enso-test\vendor\laravel\framework\src\Illuminate\Container\Container.php(608): Illuminate\Container\Container->build('LaravelEnso\Loc...')
#9 S:\Code\Laravel\enso-test\vendor\laravel\framework\src\Illuminate\Container\Container.php(575): Illuminate\Container\Container->resolve('LaravelEnso\Loc...')
#10 S:\Code\Laravel\enso-test\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(728): Illuminate\Container\Container->make('LaravelEnso\Loc...')
#11 S:\Code\Laravel\enso-test\vendor\laravel\framework\src\Illuminate\Console\Application.php(192): Illuminate\Foundation\Application->make('LaravelEnso\Loc...')
#12 S:\Code\Laravel\enso-test\vendor\laravel\framework\src\Illuminate\Console\Application.php(206): Illuminate\Console\Application->resolve('LaravelEnso\Loc...')
#13 S:\Code\Laravel\enso-test\vendor\laravel\framework\src\Illuminate\Support\ServiceProvider.php(232): Illuminate\Console\Application->resolveCommands(Array)
#14 S:\Code\Laravel\enso-test\vendor\laravel\framework\src\Illuminate\Console\Application.php(111): Illuminate\Support\ServiceProvider->Illuminate\Support{closure}(Object(Illuminate\Console\Application))
#15 S:\Code\Laravel\enso-test\vendor\laravel\framework\src\Illuminate\Console\Application.php(58): Illuminate\Console\Application->bootstrap()
#16 S:\Code\Laravel\enso-test\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(284): Illuminate\Console\Application->__construct(Object(Illuminate\Foundation\Application), Object(Illuminate\Events\Dispatcher), '5.4.27')
#17 S:\Code\Laravel\enso-test\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(122): Illuminate\Foundation\Console\Kernel->getArtisan()
#18 S:\Code\Laravel\enso-test\artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 {main}

It seems that problem lies in \Classes\LangFileManager.php where the directory separator is hard-coded to ''. When i change it to the PHP constant DIRECTORY_SEPARATOR, the error is resolved.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.