Module: Applocale
- Defined in:
- lib/applocale.rb,
lib/applocale/version.rb,
lib/applocale/Core/init.rb,
lib/applocale/Util/lang.rb,
lib/applocale/Command/init.rb,
lib/applocale/Core/setting.rb,
lib/applocale/Util/platform.rb,
lib/applocale/Util/file_util.rb,
lib/applocale/Util/injection.rb,
lib/applocale/Util/error_util.rb,
lib/applocale/Util/error_util.rb,
lib/applocale/Util/error_util.rb,
lib/applocale/Util/error_util.rb,
lib/applocale/Util/regex_util.rb,
lib/applocale/Util/config_util.rb,
lib/applocale/Core/ParseCSV/parse_csv.rb,
lib/applocale/Core/ParseXLSX/parse_xlsx.rb,
lib/applocale/Core/ParseXLSX/parse_xlsx.rb,
lib/applocale/Core/convert_to_localefile.rb,
lib/applocale/Core/GoogleHepler/google_helper.rb,
lib/applocale/Core/ParseXLSX/parse_xlsx_module.rb,
lib/applocale/Core/ParseXLSX/parse_xlsx_module.rb,
lib/applocale/Core/ParseModel/parse_model_module.rb,
lib/applocale/Core/ParserStringFile/parse_xml_file.rb,
lib/applocale/Core/ParserStringFile/parse_strings_file.rb,
lib/applocale/Core/ParserStringFile/parse_localized_resource.rb
Defined Under Namespace
Modules: Config, ErrorUtil, Locale, ParseModelModule, ParseXLSXModule, Platform Classes: Command, ContentUtil, ConvertToStrFile, FilePathUtil, GoogleHelper, Injection, Injeust, ParseCSV, ParseLocalizedResource, ParseStringsFile, ParseXLSX, ParseXMLFile, ValidKey
Constant Summary collapse
- VERSION =
"0.2.4"
Class Method Summary collapse
- .create_config_file(platformStr = nil, projpath = Dir.pwd) ⇒ Object
- .findkey(key, projpath = Dir.pwd) ⇒ Object
- .start_local_update(asetting = nil, projpath = Dir.pwd) ⇒ Object
- .start_reverse(is_skip, projpath = Dir.pwd) ⇒ Object
- .start_update(projpath = Dir.pwd) ⇒ Object
Class Method Details
.create_config_file(platformStr = nil, projpath = Dir.pwd) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/applocale/Core/init.rb', line 16 def self.create_config_file( platformStr = nil, projpath = Dir.pwd) proj_path = projpath proj_path = Dir.pwd if projpath.nil? proj_apath = Applocale::FilePathUtil.get_proj_absoluat_path(proj_path) if platformStr.nil? if Dir.glob("#{proj_apath}/**/*.xcodeproj").length > 0 || Dir.glob("#{proj_apath}/*.xcworkspace").length > 0 platformsybom = Platform::IOS elsif Dir.glob("#{proj_apath}/**/*.gradle").length > 0 platformsybom = Platform::ANDROID else Applocale::ErrorUtil::CommandError.new("Mssing [platform] : ios | android ").raise end else platformsybom = Platform.init(platformStr.strip) end if platformsybom.nil? ErrorUtil::CommandError.new("Invalid [platform] : ios | android ").raise else Applocale::Config::ConfigUtil.create_configfile_ifneed(platformsybom,proj_apath.to_s ) end end |
.findkey(key, projpath = Dir.pwd) ⇒ Object
87 88 89 90 91 92 93 94 95 |
# File 'lib/applocale/Core/init.rb', line 87 def self.findkey( key, projpath = Dir.pwd) proj_path = projpath proj_path = Dir.pwd if projpath.nil? proj_apath = Applocale::FilePathUtil.get_proj_absoluat_path(proj_path) obj = Applocale::Config::ConfigUtil.new(proj_apath) report_folder = File.dirname(obj.configfile_pathstr) findobj = FindStrKey::FindValue.new(Applocale::Platform::IOS, proj_apath, report_folder, key) findobj.find end |
.start_local_update(asetting = nil, projpath = Dir.pwd) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/applocale/Core/init.rb', line 60 def self.start_local_update(asetting = nil, projpath = Dir.pwd) proj_path = projpath proj_path = Dir.pwd if projpath.nil? proj_apath = Applocale::FilePathUtil.get_proj_absoluat_path(proj_path) setting = asetting if setting.nil? obj = Applocale::Config::ConfigUtil.new(proj_apath) setting = obj.load_configfile_to_setting end case setting.export_format when 'csv' parser = Applocale::ParseCSV.new(setting.platform, setting.export_to, setting.lang_path_list, setting.sheet_obj_list) when 'xlsx' parser = Applocale::ParseXLSX.new(setting.platform, setting.xlsxpath, setting.lang_path_list, setting.sheet_obj_list) end ConvertToStrFile.convert(setting.platform, setting.lang_path_list,parser.result, setting.rubycode) end |
.start_reverse(is_skip, projpath = Dir.pwd) ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'lib/applocale/Core/init.rb', line 78 def self.start_reverse( is_skip, projpath = Dir.pwd) proj_path = projpath proj_path = Dir.pwd if projpath.nil? proj_apath = Applocale::FilePathUtil.get_proj_absoluat_path(proj_path) obj = Applocale::Config::ConfigUtil.new(proj_apath) setting = obj.load_configfile_to_setting Applocale::ParseLocalizedResource.new(is_skip,setting.platform,setting.xlsxpath, setting.lang_path_list, setting.sheet_obj_list, setting.rubycode ) end |
.start_update(projpath = Dir.pwd) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/applocale/Core/init.rb', line 38 def self.start_update(projpath = Dir.pwd) proj_path = projpath proj_path = Dir.pwd if projpath.nil? proj_apath = Applocale::FilePathUtil.get_proj_absoluat_path(proj_path) obj = Applocale::Config::ConfigUtil.new(proj_apath) setting = obj.load_configfile_to_setting if setting.link.to_s.length <= 0 ErrorUtil::ConfigFileInValid.new('[link] is missing in config file ').raise end if Applocale::GoogleHelper.is_googlelink(setting.link) if setting.google_credentials_path.to_s.length <= 0 setting.google_credentials_path = File.(FilePathUtil.default_google_credentials_filename, File.dirname(setting.configfile_pathstr)) end googleobj = Applocale::GoogleHelper.new(setting.link, setting.google_credentials_path, setting.xlsxpath) googleobj.download(setting.sheet_obj_list, export_format: setting.export_format, export_to: setting.export_to) else download = open(setting.link) IO.copy_stream(download, setting.xlsxpath) end Applocale.start_local_update(setting, proj_path) end |