Comments (12)
I want this too by won't be able to work on it too soon.
A PR would be appreciated.
from localisation.
Now I think I understand your problem. We can extract the helper function in a file and import it in the mixin file, or wherever we need it.
from localisation.
FYI: had other priorities popping up but I should be able to provide a PR for this soonish (with a bit of luck this week; otherwise more towards 2nd week of december)
from localisation.
It turns out implementing this was simpler than expected.
PR coming up (in Core, as changes were in the __
mixin & localisation store only; which resides there)
Notables:
-
Key collection code was moved to the store to improve compatibility (
__
can be called from within the store too, previously this didn't trigger the collector) & allow collecting of parameterized keys (cleanly) -
It does also support uppercasing according to the parameter (full uppercase & first letter uppercased)
-
We should probably consider moving the missing key logic (tracking array & request) outside of the main store to reduce code smell (the store is being imported into the localisation module as that sadly enough was the cleanest solution without moving
addMissingKey
out of the localisation store; it works; I haven't discovered any issues doing it this way; but it's most likely wasting some resources)
Thoughts on/possibilities for addMissingKey
:
- Leave as is (should be ok as it's a route only used on local environments, basically as a development aid; long-term effects unknown)
- Move to a separate store (is it worth creating a store for an
axios.patch
& storing an array? - Make the patch call directly from the getter; store the pending keys in a
window
ordocument
-level array?
from localisation.
Sorry for the delay but I'm abroad and I have limited time near the computer.
Key collection code was moved to the store to improve compatibility (__ can be called from within the store too, previously this didn't trigger the collector) & allow collecting of parameterized keys (cleanly)
From the store point of view __
is a getter. From the app point of view __
is a global helper for translation. Before having the key collection logic the global helper's role was just avoiding having to use mapGetters in every component.
Moving the key collection logic to the store, as a general idea does not increase any "compatibility", you already have access to this.__
from every component and don't need to map the getter.
The current implementation for the key collector was not the cleanest architectural choice but its utility combined with the fact that is usable only in dev mode made it worth it.
I'll comment further on the PR.
from localisation.
Sorry for the delay but I'm abroad and I have limited time near the computer.
No problem
The current implementation for the key collector was not the cleanest architectural choice but its utility combined with the fact that is usable only in dev mode made it worth it.
I understand, hence why it remained intact (but moved to the store as you don't have the middleware available from within the store)
and don't need to map the getter.
No indeed, but you had to manually add the keys instead of them being collected with anything using this.__
; with the move this is no longer the case.
from localisation.
No indeed, but you had to manually add the keys instead of them being collected with anything using this.__; with the move this is no longer the case.
What do you mean?
from localisation.
That code is located in the store (as it affects the store & is used globally in different ways)
The mixin doesn't apply here; and thus it's logic had to be moved to the store itself for it to work as expected (more cases are following where we require a similar approach)
edit: note that "incorrect credentials" here only applies to a temporary (non-Enso) authentication required in certain cases; it's unrelated to the actual session's login user
from localisation.
Sounds like a reasonable alternative.
Sorry for the late reply btw, I've been coping with illness.
I'll make the requested changes soon (will be for next week though as I have to catch up & holidays coming up starting wednesday ;) )
from localisation.
Where are we on this?
from localisation.
Only got back from holiday yesterday, will be done after completing our backlog (hopefully tomorrow now)
from localisation.
Updated, see laravel-enso/core#87
from localisation.
Related Issues (20)
- Error message for selects not translated HOT 5
- Document title not translated if 'extendedDocumentTitle' => true
- Datatable not translated HOT 2
- Language of login page HOT 2
- Datepicker in Form: Select Date not translated HOT 15
- Document title not translated after reload HOT 1
- Errors on login page (in 2.5.5) HOT 1
- Toastr title not translated on login screen HOT 7
- Translate time info in notifications HOT 1
- Don't get 2.3.7 on composer update HOT 1
- Update Tests HOT 1
- Build Factories for all relevant packages
- can_store_language expects deleted files HOT 3
- Language not set in Laravel session? HOT 2
- Support filtering on translation values in editTexts HOT 6
- Localisation of login/password reset HOT 2
- system.localisation.merge 404 exception
- Refactor
- [bug] Remove key from lang files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from localisation.