如何自动本地化常见问题和“关于”分类

tos_topic is definitely already translated to Spanish.

To update it I think the simplest way would be removing the link to the topic in the DB and doing a rebuild.

I agree it is not that great that we seed these topics before you have picked a locale. @gerhard we should think of a better long term solution here.

What we can do is glue a custom field to the topics we create so when you change locale, a rebuild brings in the correct topics.

So in 990_topics.rb

  1. When creating these topics we set the custom field of topic_locale.

  2. IF we have SiteSetting.XYZ_topic_id, THEN look at custom field… IF it is there and locale does not match current locale, create a new topic.

This is not 100% ideal, cause there is a big delay (has to wait for a rebuild)

BUT if we triggered the same process on SiteSetting change it could be workable. I really dislike that SO MANY sites have TOS etc in the wrong language.

To work around:

./launcher enter app
rails c
SiteSetting.tos_topic_id = 0
SiteSetting.guidelines_topic_id = 0
SiteSetting.private_topic_id = 0

exit 
exit

./launcher rebuild app
7 个赞