Skip to content

Commit

Permalink
feat: add skipSyncUiTranslation option
Browse files Browse the repository at this point in the history
  • Loading branch information
mwakizaka committed Nov 24, 2023
1 parent 3c670b7 commit 5b6a117
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/simulator-xcode-9.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ class SimulatorXcode9 extends SimulatorXcode8 {
/**
* @typedef {Object} LanguageOptions
* @property {string} name The name of the language, for example `de` or `zh-Hant-CN`
* @property {boolean} skipSyncUiDialogTranslation skip sync UI dialog translation when true
*/

/**
Expand Down Expand Up @@ -600,6 +601,8 @@ class SimulatorXcode9 extends SimulatorXcode8 {
`The 'AppleLanguages' preference is already set to '${globalPrefs.AppleLanguages}'. ` +
`Skipping services reset`
);
} else if (language.skipSyncUiDialogTranslation) {

Check failure on line 604 in lib/simulator-xcode-9.js

View workflow job for this annotation

GitHub Actions / test (13.1, iPhone X, 15)

'language' is possibly 'undefined'.

Check failure on line 604 in lib/simulator-xcode-9.js

View workflow job for this annotation

GitHub Actions / test (14.2, iPhone 14, 16.2)

'language' is possibly 'undefined'.

Check failure on line 604 in lib/simulator-xcode-9.js

View workflow job for this annotation

GitHub Actions / test (20)

'language' is possibly 'undefined'.

Check failure on line 604 in lib/simulator-xcode-9.js

View workflow job for this annotation

GitHub Actions / test (18)

'language' is possibly 'undefined'.

Check failure on line 604 in lib/simulator-xcode-9.js

View workflow job for this annotation

GitHub Actions / test (16)

'language' is possibly 'undefined'.
log.info('Skipping services reset because skipSyncUiDialogTranslation is true');
} else {
log.info(
`Will restart the following services in order to sync UI dialogs translation: ` +
Expand Down
9 changes: 9 additions & 0 deletions test/unit/simulator-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,15 @@ launchd_s 35621 mwakizaka 16u unix 0x7b7dbedd6d62e84f 0t0 /private/
);
spawnProcessSpy.callCount.should.eql(1);
});

it('should confirm skip restarting services if skipSyncUiDialogTranslation is true', async function () {
const options = {language: {name: 'ja', skipSyncUiDialogTranslation: true}};
(await sim.configureLocalization(options)).should.be.true;
spawnProcessSpy.firstCall.args[0].should.eql(
['defaults', 'write', '.GlobalPreferences.plist', 'AppleLanguages', '<array><string>ja</string></array>']
);
spawnProcessSpy.callCount.should.eql(1);
});
});
});
});

0 comments on commit 5b6a117

Please sign in to comment.