class RunLoop::Language
@!visibility private
Constants
- LANGUAGE_CODES
@!visibility private
Generated with:
NSArray *identifiers = [[NSLocale availableLocaleIdentifiers]
sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
NSMutableOrderedSet *set = [NSMutableOrderedSet new]; for (NSString *localeId in identifiers) {
NSString *langCode = [NSLocale canonicalLanguageIdentifierFromString:localeId]; [set addObject:langCode];
}
for (NSString *langCode in set) {
printf("\"%s\",", [langCode cStringUsingEncoding:NSUTF8StringEncoding]);
}
Public Class Methods
codes_for_device(device)
click to toggle source
@!visibility private Returns a list of known language codes for a device based on iOS version
@param [RunLoop::Device] device
@return [Array<String>] an array of language codes for the device
@raise [ArgumentError] if there are no codes for a device version
# File lib/run_loop/language.rb, line 24 def self.codes_for_device(device) major_version = device.version.major key = RunLoop::Version.new("#{major_version}.0") LANGUAGE_CODES[key] end
valid_code_for_device?(lang_code, device)
click to toggle source
@!visibility private Is the lang_code valid for this device?
# File lib/run_loop/language.rb, line 7 def self.valid_code_for_device?(lang_code, device) valid_codes = self.codes_for_device(device) if valid_codes.nil? false else valid_codes.include?(lang_code) end end