i18n: pass only the ISO code string to 'translate()'

Don't use the whole Hash everywhere.
Also fall back nicely to english string if no translation exists.
This commit is contained in:
Samantaz Fox
2021-11-08 23:52:55 +01:00
parent 301444563b
commit 139786b9ef
23 changed files with 133 additions and 126 deletions

View File

@@ -275,7 +275,7 @@ struct Video
end
end
def to_json(locale : Hash(String, JSON::Any) | Nil, json : JSON::Builder)
def to_json(locale : String?, json : JSON::Builder)
json.object do
json.field "type", "video"
@@ -475,7 +475,7 @@ struct Video
end
# TODO: remove the locale and follow the crystal convention
def to_json(locale : Hash(String, JSON::Any) | Nil, _json : Nil)
def to_json(locale : String?, _json : Nil)
JSON.build { |json| to_json(locale, json) }
end