From 6ba575e0d355ad9aed7031c61eb3392273363cd2 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 21 May 2025 18:22:54 +0200 Subject: [PATCH] [Glitch] Use more generic locale as fallback for rules Port 6ab96ba647ae51ab3f09636ee10b1cd8e4e20488 to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/features/about/index.jsx | 4 ++-- app/javascript/flavours/glitch/features/report/rules.jsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/features/about/index.jsx b/app/javascript/flavours/glitch/features/about/index.jsx index 81132f21e7..2b0c356acb 100644 --- a/app/javascript/flavours/glitch/features/about/index.jsx +++ b/app/javascript/flavours/glitch/features/about/index.jsx @@ -171,8 +171,8 @@ class About extends PureComponent { ) : (
    {server.get('rules').map(rule => { - const text = rule.getIn(['translations', locale, 'text']) || rule.get('text'); - const hint = rule.getIn(['translations', locale, 'hint']) || rule.get('hint'); + const text = rule.getIn(['translations', locale, 'text']) || rule.getIn(['translations', locale.split('-')[0], 'text']) || rule.get('text'); + const hint = rule.getIn(['translations', locale, 'hint']) || rule.getIn(['translations', locale.split('-')[0], 'hint']) || rule.get('hint'); return (
  1. {text}
    diff --git a/app/javascript/flavours/glitch/features/report/rules.jsx b/app/javascript/flavours/glitch/features/report/rules.jsx index b77d75df2f..c0b1de3abb 100644 --- a/app/javascript/flavours/glitch/features/report/rules.jsx +++ b/app/javascript/flavours/glitch/features/report/rules.jsx @@ -51,7 +51,7 @@ class Rules extends PureComponent { value={item.get('id')} checked={selectedRuleIds.includes(item.get('id'))} onToggle={this.handleRulesToggle} - label={item.getIn(['translations', locale, 'text']) || item.get('text')} + label={item.getIn(['translations', locale, 'text']) || item.getIn(['translations', locale.split('-')[0], 'text']) || item.get('text')} multiple /> ))}