Chinese translations missing?

(Rex) #1

Hello, I’m Traditional Chinese user. When I upgrade the version of discourse in developer env to 1.2, I found some translations are missing. But I could found the original text in client.en.yml or server.en.yml. And I try to switch discourse to English version to see the original text, I got these:

Why would some text stay in Chinese? Is it hard coded in js? And how do I fix it?

(Kane York) #2

Do you have allow_user_locale enabled?

Also, it might be that the admin dashboard result, including the translations, was cached.

(Sam Saffron) #3

I suspect some of the translations in transifex are using English, all those strings are localized.

(Rex) #4

No, I don’t. If the translations was cached, how can I refresh it?

And I recently found this problem happen to the beta version like 1.2.0beta4, too.

(Rex) #5

I thought I got how this bug work. The Model Report return json ( actually is a ruby Hash object, though the method named as_json… ) with localization, then Job DashboardStats store it in redis. I think the title and the axises are localized too early. They should be localized when they be fetched from redis.

Model Report:

def as_json(options = nil)
    type: type,
    title: I18n.t("reports.#{type}.title"),
    xaxis: I18n.t("reports.#{type}.xaxis"),
    yaxis: I18n.t("reports.#{type}.yaxis"),
    data: data,
    total: total,
    start_date: start_date,
    end_date: end_date,
    prev30Days: self.prev30Days

Job DashboardStats:

def execute(args)
  stats_json = AdminDashboardData.fetch_stats.as_json

  # Add some extra time to the expiry so that the next job run has plenty of time to
  # finish before previous cached value expires.
  $redis.setex AdminDashboardData.stats_cache_key, (AdminDashboardData.recalculate_interval + 5).minutes, stats_json.to_json