Hello All! I have a Laravel app with some content that comes from custom components, which are not data-driven. I just throw some things to the props and it renders fine. other large sections of content are data-driven.
Suddenly find myself in a place where we need some localization, but the traditional automatic options do not satisfy the individuals doing the translation. Hence, I am considering starting with a default, testing for a value of 'en' in php, and throwing variables to the prop that are based on the language. in small tests, it is working. I manually change the php variable and it renders what I am looking for.
what I am wondering - and need to bridge the gap between - if I have a drop-down and it changes to another value, what's the best way to make that change in php land and not get too much javascript involved? as I type, I am answering my question - its Livewire, right? that may be the best solution.
to be succinct - google and other automatic translations do not satisfy, I need to find an elegant solution that will be able to change easily and adapt without going crazy with javascript.
The solution I came up with was to write my own localization. converted the components I had been setting to be data driven, set up the base language in the controller, and added a matching field in the table for the alternative language. I can give them a nice interface to compare the choice side by side, which will satisfy the need to be hands on and control the info which is what they really want. I even had some fun with it, and used the matching colors of the Italian flag and American flag as a base for the button (see in English, see in Italian). Right now, it's just in the controller and not in Livewire yet, this will give me a window of opportunity to let them make whatever change requests there are, and we can get this polished in the coming days.
I have to say how much I love Laravel and this community, the way we can simply come up with solutions in this framework with an accelerated development cycle is both exciting and groundbreaking. How everyone pitches in and offers advice - and I hope to be able to help out more one day soon. I am all in, Laravel, I am here to stay.