Skip to main content

Switching Validator Language in Echo Framework #GolangDev

pixabay.com


Hello everyone, for right now I wanna share how to switch language validator in the echo framework. this framework actually using the go-playground library as its default validator. so if you wanna use a validator and have a limited example to read, just go to this repository, you can find more examples about its usability. don't forget to hit the stars, it's very useful. 


In my case, I have an issue that my current project needs me to translate the validator error message from English into Bahasa Indonesia. there is an example in the go-playground validator repository that we can switch the validator message into another language. Thank god, there is an Indonesian developer who contributes that repository to translate the message into Bahasa Indonesia. 

after implementing code from go-playground documentation, then I got next issue, the thing is we need to implement the current docs into the echo framework version, which is not suitable at all, you will find an error, and then my mind got stuck, and I got an hour to think about it.

after an hour of reading the library, reading the documentation, reading the echo framework version, and then I got a suitable solution and very nice implementation, and I think you would think the same. then Here is the gist.


Popular posts from this blog

5 Backend Framework Terkenal dari Berbagai Bahasa Pemrograman

5 Backend framework yang terkenal dari berbagai bahasa pemrograman, banyak sekali framework baru bermunculan tetapi apakah semua bagus atau baik untuk diterapkan. berikut 5 framework yang bisa kamu coba untuk jadi pilihan projectmu: 1. Laravel Laravel adalah framework dari bahasa pemrograman PHP yang sangat terkenal hari ini, daripada framework php lain, laravel memberikan fitur lebih komplit untuk membangun modern website. laravel sering dipakai untuk website system internal dan website institusi. 2. Springboot Springboot adalah framework dari Java yang menjadi andalan untuk membuat system finance dan enterprise, springboot dipakai banyak aplikasi enterprise karna kapabilitasnya dalam support kebutuhan enterprise, dengan disupport oracle, springboot mjd nomer satu dikelasnya 3. Phoenix Phoenix adalah framework dari Elixir, framework ini memiliki speciality di bidang distributed and realtime system seperti chat platform. elixir sendiri adalah bahasa pemrograman berbasis erlang, sedang...

Laravel Tips : Membuat Model, Migration dan Controller dengan Sekali Jalan

  php artisan adalah generator laravel yang berfungsi untuk membuat file kodingan dengan mudah, seperti membuat controller, model, seeder, migration dan masih banyak lagi. artisan hanya bisa di lakukan di dalam lingkungan console, seperti cmd dan terminal. berikut akan saya tunjukan cara membuat controller, model, migration menggunakan php artisan. # membuat controller ketikkan perintah di bawah ini php artisan make:controller BlogController # membuat model ketikkan perintah di bawah ini php artisan make:model Blog # membuat migration ketikkan perintah di bawah ini php artisan make:migration blog # membuat seeder ketikkan perintah di bawah ini php artisan make:seeder BlogSeeder # membuat migration, controller, dan model sekaligus ketikkan perintah di bawah ini php artisan make:model -crm Blog perintah di atas akan mengenerate controller dengan nama BlogController dengan keadaan Resource method tertulis, m...

Automatic API Documentation Swagger in Golang #GolangDev

pixabay.com In this article, I'll explain how to generate an API blueprint instantly using SwagGo in Golang. API blueprint is a document that contains a bunch of API endpoints, its slickly same as documentation but less description, it's allow another programmer to read and see all the available endpoint and try it out with sandbox feature. Swagger is one of the most used API blueprints right now, it's available in free but limited usage. if you wanna use the free credit, you need to understand YAML notation, you can read the example notation in swagger official documentation. but again, it's really hard and takes an expensive time to arranges all the notation to achieve a good API blueprint. fortunately, there are tools in Golang that allow us to generate the YAML notation and automatically generate the blueprint page with only using markup notation, and it's FREE unlimited for self-host, insane right? SwagGo tools are available here , the documentation is very cl...