Sha256: a11de7e2ca646104929ea9807b76f16020d133d70d76f847a66e6176cc593698
Contents?: true
Size: 865 Bytes
Versions: 5
Compression:
Stored size: 865 Bytes
Contents
# frozen_string_literal: true module Discorb # # Handles application commands. # module ApplicationCommand # @return [Array<String>] List of valid locales. VALID_LOCALES = %w[da de en-GB en-US es-ES fr hr it lt hu nl no pl pt-BR ro fi sv-SE vi tr cs el bg ru uk hi th zh-CN ja zh-TW ko].freeze module_function def modify_localization_hash(hash) hash.to_h do |rkey, value| key = rkey.to_s.gsub("_", "-") raise ArgumentError, "Invalid locale: #{key}" if VALID_LOCALES.none? do |valid| valid.downcase == key.downcase end && key != "default" [key == "default" ? "default" : VALID_LOCALES.find { |valid| valid.downcase == key.downcase }, value] end end end end
Version data entries
5 entries across 5 versions & 1 rubygems