mirror of
https://github.com/appium/appium.git
synced 2026-02-11 04:20:00 -06:00
Add optional argument 'language' to getStrings in iOS
This commit is contained in:
@@ -466,14 +466,15 @@ iOSController.toggleLocationServices = function (cb) {
|
||||
};
|
||||
|
||||
iOSController.getStrings = function (language, cb) {
|
||||
if (language) logger.warn("Language parameter is not implemented in iOS");
|
||||
var strings = this.localizableStrings;
|
||||
if (strings && strings.length >= 1) strings = strings[0];
|
||||
this.parseLocalizableStrings(function() {
|
||||
var strings = this.localizableStrings;
|
||||
if (strings && strings.length >= 1) strings = strings[0];
|
||||
|
||||
cb(null, {
|
||||
status: status.codes.Success.code
|
||||
, value: strings
|
||||
});
|
||||
cb(null, {
|
||||
status: status.codes.Success.code
|
||||
, value: strings
|
||||
});
|
||||
}.bind(this), language);
|
||||
};
|
||||
|
||||
iOSController.executeAtom = function (atom, args, cb, alwaysDefaultFrame) {
|
||||
|
||||
@@ -956,13 +956,23 @@ IOS.prototype.setDeviceAndLaunchSimulator = function (cb) {
|
||||
}
|
||||
};
|
||||
|
||||
IOS.prototype.parseLocalizableStrings = function (cb) {
|
||||
IOS.prototype.parseLocalizableStrings = function (cb, language) {
|
||||
if (this.args.app === null) {
|
||||
logger.info("Localizable.strings is not currently supported when using real devices.");
|
||||
cb();
|
||||
} else {
|
||||
var strings = path.resolve(this.args.app, "Localizable.strings");
|
||||
|
||||
var strings = null;
|
||||
if (language) {
|
||||
strings = path.resolve(this.args.app, language + ".lproj", "Localizable.strings");
|
||||
if (!fs.existsSync(strings)) {
|
||||
logger.info("No Localizable.strings for language '" + language + "', getting default strings");
|
||||
}
|
||||
} else if (this.args.language) {
|
||||
strings = path.resolve(this.args.app, this.args.language + ".lproj", "Localizable.strings");
|
||||
}
|
||||
if (!fs.existsSync(strings)) {
|
||||
strings = path.resolve(this.args.app, "Localizable.strings");
|
||||
}
|
||||
if (!fs.existsSync(strings)) {
|
||||
strings = path.resolve(this.args.app, "en.lproj", "Localizable.strings");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user