Class: Applocale::FilePathUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/applocale/Util/file_util.rb

Constant Summary collapse

DIRNAME_MAIN =
'AppLocale'
DIRNAME_IOS =
'IOS'
DIRNAME_ANDROID =
'Android'
DIRNAME_JSON =
'locales'
FILENAME_CONFIG =
'AppLocaleFile'
FILENAME_XLSX =
'string.xlsx'
GOOGLE_CREDENTIALS =
'google_credentials.yaml'
EXPORT_FORMAT =
'xlsx'

Class Method Summary collapse

Class Method Details

.default_config_filenameObject



28
29
30
# File 'lib/applocale/Util/file_util.rb', line 28

def self.default_config_filename
  return FILENAME_CONFIG
end

.default_export_formatObject



61
62
63
# File 'lib/applocale/Util/file_util.rb', line 61

def self.default_export_format
  EXPORT_FORMAT
end

.default_export_toObject



32
33
34
# File 'lib/applocale/Util/file_util.rb', line 32

def self.default_export_to
  return DIRNAME_MAIN + "/Resource"
end

.default_google_credentials_filenameObject



24
25
26
# File 'lib/applocale/Util/file_util.rb', line 24

def self.default_google_credentials_filename
  return GOOGLE_CREDENTIALS
end

.default_localefile_relative_pathstr(platform, lang) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/applocale/Util/file_util.rb', line 41

def self.default_localefile_relative_pathstr(platform, lang)
  if platform == Platform::IOS
    dirname = DIRNAME_IOS
  elsif platform == Platform::ANDROID
    dirname = DIRNAME_ANDROID
  elsif platform == Platform::JSON
    dirname = DIRNAME_JSON
  end
  unless dirname.nil?
    filename = Locale.filename(platform, lang)
    return "#{dirname}/#{filename}"
  end
  return nil
end

.default_mainfolderObject



36
37
38
# File 'lib/applocale/Util/file_util.rb', line 36

def self.default_mainfolder
  return DIRNAME_MAIN
end

.default_xlsx_relativepath_strObject



56
57
58
59
# File 'lib/applocale/Util/file_util.rb', line 56

def self.default_xlsx_relativepath_str
  filename = FILENAME_XLSX
  return filename
end

.get_proj_absoluat_path(proj_path) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/applocale/Util/file_util.rb', line 16

def self.get_proj_absoluat_path(proj_path)
  path = proj_path
  if !(Pathname.new proj_path).absolute?
    path = File.expand_path(proj_path,Dir.pwd)
  end
  return path
end

.str_to_folderpathstr(str) ⇒ Object



65
66
67
68
69
70
# File 'lib/applocale/Util/file_util.rb', line 65

def self.str_to_folderpathstr(str)
  pathstr = Pathname.new(str.strip)
  if File.directory?(pathstr)
    pathstr = File.join(self.configfile_pathstr, FilePathUtil.default_config_filename).to_s
  end
end