Independent Development
Multiply language support in WordPress
Error
The front page got an error of undefined __.
I am not sure how to fix it, because I use Vite to compile my React code into a WordPress plugin.
Solution
I just deleted everything using __ or i18n.
I am developing an English site, and maybe I would consider how to implement the i18n later.
The boolean column in Database Table and how to shown on the React / JavaScript website
Error
I have a BOOLEAN column in tables, but when I select them and pass them to frontend React code, using a variable to accept it, it is not true / false.
Solution
Typically, MySQL has no BOOLEAN values. Its will be turned into 0 / 1.
So on the website, the value should be judged before assigned to a variable which means to be true or false.
Related Platforms
(Github Issues) / (Notion) / (Blog)
Advertisement
(A website to optimize your resume and to boost your career: Nonpareil.me)
独立开发
WordPress中的多语言问题
问题
前端报错,undefined __。
无从下手。我是用Vite编译React代码,生成Wordpress插件。这个流程我不够熟悉。
解决方案
我直接删除了所有的__和i18n。
现在我开发的网站只有英文版本,以后再来关心这个问题吧。
数据库中的布尔值无法在前端正确展示
问题
我在数据库中,创建表格时设置了一个BOOLEAN值,在PHP中把它select出来传递给前端,前端的值不正确。
解决方案
MySQL中实际上没有BOOLEAN值,是用TinyINT存储的。所以这个存储的是0或者1。
前端使用时不能直接赋值,必须要和1做比较判断,才能正确得到true或者false。
相关平台
(Github Issues) / (Notion) / (Blog)