def upsert(locale, key, value) # rubocop:disable Metrics/MethodLength
      I18n.with_locale(locale) do
        # when an array has to be inserted with a default value, it needs to
        # be done like:
        # I18n.t('foo', default: [['bar', 'baz']])
        # because without the double array, array items are treated as fallback keys
        # - then, the last array element is the final fallback; so in this case we
        # don't specify fallback keys and only specify the final fallback, which
        # is the array
        val = value.is_a?(Array) ? [value] : value
        I18n.t(key, default: val)
        unless @raw
          # this indicates that this translation already exists
          existing_translation =
            Lit::Localization.joins(:locale, :localization_key)
                             .find_by('localization_key = ? and locale = ?',
                                      key, locale)
          if existing_translation
            existing_translation.update(translated_value: value, is_changed: true)
            lkey = existing_translation.localization_key
            lkey.update(is_deleted: false) if lkey.is_deleted
          end
        end
      end
    end
def upsert(locale, key, value) # rubocop:disable Metrics/MethodLength
      I18n.with_locale(locale) do
        # when an array has to be inserted with a default value, it needs to
        # be done like:
        # I18n.t('foo', default: [['bar', 'baz']])
        # because without the double array, array items are treated as fallback keys
        # - then, the last array element is the final fallback; so in this case we
        # don't specify fallback keys and only specify the final fallback, which
        # is the array
        val = value.is_a?(Array) ? [value] : value
        I18n.t(key, default: val)
        unless @raw
          # this indicates that this translation already exists
          existing_translation =
            Lit::Localization.joins(:locale, :localization_key)
                             .find_by('localization_key = ? and locale = ?',
                                      key, locale)
          if existing_translation
            existing_translation.update(translated_value: value, is_changed: true)
            lkey = existing_translation.localization_key
            lkey.update(is_deleted: false) if lkey.is_deleted
          end
        end
      end
    end
This is mean to insert a value for a key in a given locale
 using some kind of strategy which depends on the service's options.

 For instance, when @raw option is true (it's the default),
 if a key already exists, it overrides the default_value of the
 existing localization key; otherwise, with @raw set to false,
 it keeps the default as it is and, no matter if a translated value
 is there, translated_value is overridden with the imported one
 and is_changed is set to true.