mirror of
https://github.com/discourse/discourse.git
synced 2026-08-12 05:55:39 -05:00
FEATURE: Show available interpolation keys when overriding translations (#22220)
This is the first of a number of PRs aimed at helping admins manage their translation overrides. It simply adds a list of available interpolation keys below the input field when editing an override. It also includes custom interpolation key.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class SiteTextSerializer < ApplicationSerializer
|
||||
attributes :id, :value, :overridden?, :can_revert?
|
||||
attributes :id, :value, :interpolation_keys, :has_interpolation_keys?, :overridden?, :can_revert?
|
||||
|
||||
def id
|
||||
object[:id]
|
||||
@@ -11,6 +11,14 @@ class SiteTextSerializer < ApplicationSerializer
|
||||
object[:value]
|
||||
end
|
||||
|
||||
def interpolation_keys
|
||||
object[:interpolation_keys]
|
||||
end
|
||||
|
||||
def has_interpolation_keys?
|
||||
object[:interpolation_keys].present?
|
||||
end
|
||||
|
||||
def overridden?
|
||||
if options[:overridden_keys]
|
||||
options[:overridden_keys].include?(object[:id])
|
||||
|
||||
Reference in New Issue
Block a user