16 Annoying Airline Passenger Habits That Drive Us Crazy

While we all need to exercise some degree of tolerance, there are intentionally rude and inconsiderate people you may have the pleasure of flying every so often.

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Laravel Localization Guide

One of the things that wastes my time the most is localizing my Laravel app after a long journey of developing in a mono language type of way.

So, during my experience i grew to learn that whatever i do, whenever there is a text to be displayed to the end user that text should be wrapped in the translation functions of Laravel

But turns out that is not enough, as after you finished your work the real job of localizing your app let’s say to Arabic and French starts here, because at this point, you’ll need to copy all your strings to the Json files inside the lang directory and then start the translation of your keys.

The installation and use of the package are straight forward, you just run:

Then run the views scanner with the translator:update commande

And voila … you get this error:

and this is not the authors fault really its totally mine because i didn’t read the config file, which by the way you need to publish it:

And if the translation files are in the lang directory instead of ressources/lang then you need to change the output in the config file:

This is mainly for laravel 9 and up.

Any way the error was caused by this line in the config file:

So, you only need to change the array to the locales you need and create their files in the output directory then run the translator:update commande and voila. it will work!

Note to self here: the locales declared in the array (ex: [‘ar’, ‘fr’, ‘en’]) should have their Json files created even if empty in the output directory.

This method saved me a lot of time regarding the getting of the translation strings in my views, but the actual job of translation is still on me and it still requires a lot of time if done manually.

And for me the (FREE) solution to reduce that time was chatGPT, it understands the task given clearly and it delivers on it, i simply instructed it with this prompt

and given it part of my Json object enough for it to give me a complete response and that’s it more time Gained!

[Edit]

You just simply generate you initial Json file probably in English and keep the value same as the key:

You can also upload your file directly and download the results

I hope this post helps you gain time in this area of Laravel development.

Have a good day!

Add a comment

Related posts:

How Some Countries Tax Bitcoin

Cryptocurrency is a digital asset designed to work as a medium of exchange that uses strong cryptography to secure financial transactions, control the creation of additional units and verify the…

Buy Verified Facebook Business Manager

Buy Verified Facebook Business Manager Introduction The Facebook business managers are one of the best ways to advertise your company. They can help you grow your brand by posting content that people…

VPN stands for Virtual Private Network

VPN stands for Virtual Private Network. It is a technology that creates a secure and encrypted connection between two or more devices over the internet. When a user connects to a VPN, their internet…