Module: Applocale::Platform

Defined in:
lib/applocale/Util/platform.rb

Constant Summary collapse

IOS =
:ios
ANDROID =
:Android

Class Method Summary collapse

Class Method Details

.init(platform) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/applocale/Util/platform.rb', line 7

def self.init(platform)
  if platform.upcase == 'IOS'
    return Platform::IOS
  elsif platform.upcase == 'ANDROID'
    return Platform::ANDROID
  end
  return nil
end

.is_valid_path(platform, path) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/applocale/Util/platform.rb', line 16

def self.is_valid_path(platform, path)
  newpath = path.to_s.strip
  extn = File.extname  newpath
  if platform == Platform::IOS
    if extn.downcase == '.strings'
      return true
    end
  elsif platform == Platform::ANDROID
    if extn.downcase == '.xml'
      return true
    end
  end
  return false
end