Skip to content

A platform for community discussion. Free, open, simple.

DEV: Unify locale copy and use absolute date (#36443)

Keegan George2fbafb7c8f45
diff --git a/plugins/discourse-ai/app/controllers/concerns/ai_credit_limit_handler.rb b/plugins/discourse-ai/app/controllers/concerns/ai_credit_limit_handler.rb
index d211e5f9ba2..d454db88c62 100644
--- a/plugins/discourse-ai/app/controllers/concerns/ai_credit_limit_handler.rb
+++ b/plugins/discourse-ai/app/controllers/concerns/ai_credit_limit_handler.rb
@@ -21,7 +21,7 @@ module AiCreditLimitHandler
end
user_type = current_user&.admin? ? "admin" : "user"
- reset_time = allocation&.relative_reset_time.presence || ""
+ reset_time = allocation&.formatted_reset_time.presence || ""
message =
I18n.t(
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-translations.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-translations.gjs
index 5b1d51b675a..aefb19f521d 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-translations.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-translations.gjs
@@ -69,8 +69,8 @@ export default class AiTranslations extends Component {
return null;
}
const resetTime =
- this.creditStatus?.reset_time_relative ||
- this.creditStatus?.reset_time_formatted;
+ this.creditStatus?.reset_time_formatted ||
+ this.creditStatus?.reset_time_absolute;
if (resetTime) {
return htmlSafe(
i18n("discourse_ai.translations.credit_limit_warning", {
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/services/ai-credits.js b/plugins/discourse-ai/assets/javascripts/discourse/services/ai-credits.js
index e44328cbb50..4b2f73b4d57 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/services/ai-credits.js
+++ b/plugins/discourse-ai/assets/javascripts/discourse/services/ai-credits.js
@@ -113,7 +113,7 @@ export default class AiCredits extends Service {
*/
getCreditLimitMessage(creditStatus) {
const resetTime =
- creditStatus?.reset_time_relative || creditStatus?.reset_time_formatted;
+ creditStatus?.reset_time_formatted || creditStatus?.reset_time_absolute;
return getAiCreditLimitMessage({
resetTime,
diff --git a/plugins/discourse-ai/config/locales/client.en.yml b/plugins/discourse-ai/config/locales/client.en.yml
index eb444943b06..d67544728fb 100644
--- a/plugins/discourse-ai/config/locales/client.en.yml
+++ b/plugins/discourse-ai/config/locales/client.en.yml
@@ -370,7 +370,7 @@ en:
title: "Translates this post to all supported languages"
confirm: "This will update any existing translations on this post. Are you sure?"
success: "Post has been sent for translation"
- credit_limit_warning: "Translations are paused due to credit limits. They will resume when credits reset %{reset_time}."
+ credit_limit_warning: "Translations are paused due to credit limits. They will resume when credits reset at %{reset_time}."
credit_limit_warning_no_time: "Translations are paused due to credit limits. They will resume when credits reset."
spam:
@@ -839,8 +839,8 @@ en:
errors:
credit_limit_dialog:
title: "AI credit limit reached"
- message_user: "You have reached the AI credit limit for your plan. Responses will be unavailable until your limit resets at %{reset_time}. Please contact your site administrator for more information."
- message_without_time_user: "You have reached the AI credit limit for your plan. Responses will be unavailable until your limit resets. Please contact your site administrator for more information."
+ message_user: "This community has reached its AI credit limit for today. Please try again after %{reset_time} or contact your site administrator for more information."
+ message_without_time_user: "This community has reached its AI credit limit for today. Responses will be unavailable until your limit resets. Please contact your site administrator for more information."
message_admin: "You have reached the AI credit limit for your plan. Responses will be unavailable until your limit resets at %{reset_time}."
message_without_time_admin: "You have reached the AI credit limit for your plan. Responses will be unavailable until your limit resets."
diff --git a/plugins/discourse-ai/config/locales/server.en.yml b/plugins/discourse-ai/config/locales/server.en.yml
index 994387c1d96..6b02aadd0a0 100644
--- a/plugins/discourse-ai/config/locales/server.en.yml
+++ b/plugins/discourse-ai/config/locales/server.en.yml
@@ -678,8 +678,8 @@ en:
all_posts_translated: "All posts in this topic are already translated."
llm_credit_allocation:
- limit_exceeded_user: "You have reached your AI credit limit. Please try again in %{reset_time}. Please contact your site administrator for more information."
- limit_exceeded_admin: "You have reached your AI credit limit. Please try again in %{reset_time}."
+ limit_exceeded_user: "This community has reached its AI credit limit for today. Please try again after %{reset_time} or contact your site administrator for more information."
+ limit_exceeded_admin: "You have reached your AI credit limit. Please try again after %{reset_time}."
errors:
quota_exceeded: "You have exceeded the quota for this model. Please try again in %{relative_time}."