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

OpenVPN Alternatif Solusi Menanggulangi Blokir dari KOMINFO

Sejak akhir juli 2022 kemaren indonesia di gegerkan dengan tindakan kominfo atas diblokirnya banyak platform digital karna tidak mendaftar PSE, terutama paypal dan plaform game (steam, epic game dll). keputusan ini semakin membuat netizen geram dikarenakan platform judi online malah disetujui untuk beroperasi karna sudah daftar PSE. Jujur menurut saya memang keputusan ini sejak awal saya dengar sudah mengada-ada karna sangat aneh memblokir semua platform digital yang jumlahnya tidak terhitung banyaknya dan hanya membolehkan akses platform yang sudah mendaftar yang jumlahnya hanya ratusan.  saya sebagai developer juga merasa aneh banget ini kebijakan apalagi platform development juga banyak yang di blacklist oleh kominfo seperti, github, gitlab, bitbucket, even website CDN pun di blacklist. astaga wkwkwk. anyway terlepas dari kebijakan konyol ini, saya mau berbagi tips cara agar tetep bisa mengakses semua platform tersebut tanpa ada halangan, yaitu dengan menggunakan VPN. banyak ban...

Langkah-Langkah Membersihkan Virus Shortcut Versi 3.x

  Virus Shortcut adalah virus yang menampakkan dirinya dalam bentuk shortcut, dalam penyebarannya virus ini menggunakan media penyimpanan dan membuat shortcut di dalam penyimpanan tersebut lalu mengaktifkan dirinya dengan cara memanfaatkan kelemahan pengguna untuk meng klik shortcut tersebut. Tujuan dari virus ini sangat sederhana, hanya ingin menyebarkan dirinya ke komputer korban dan membuat komputer korban menjadi sarangnya, tanpa merusak isi atau file dari komputer korban, maka dari itu virus ini di golongkan menjadi virus junk (baca:virus sampah). virus shorcut yang terbaru di tandai dengan hilangnya semua file dan folder kita saat pertama kali membuka media penyimpanan seperti flashdisk dan memory card, tetapi ada satu file yaitu file shortcut yang memiliki nama sesuai nama media penyimpanan kita. apabila kita klik shortcut tersebut maka akan muncul window explorer baru dan file kita akan muncul semua. apabila anda menemui tanda-tanda seperti di atas, maka 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...