Skip to content

Commit e3e6255

Browse files
authored
Merge pull request #164 from hellosign/develop
feat: Avoid defaulting to English if locale is not set
2 parents 5628cd8 + 1baea0c commit e3e6255

4 files changed

Lines changed: 92 additions & 107 deletions

File tree

‎src/defaults.js‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
import settings from './settings';
2-
31
export default {
42
allowCancel: true,
53
debug: false,
6-
locale: settings.locales.EN_US,
74
skipDomainVerification: false,
85
testMode: false,
96
timeout: 30000, // 30 seconds

‎src/embedded.js‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,21 +252,23 @@ class HelloSign extends Emitter {
252252
}
253253

254254
/**
255-
* Validates and appends the "user_culture" parameter to
256-
* the iFrame params object.
255+
* Appends the "user_culture" parameter to the iFrame
256+
* params object if it is defined.
257257
*
258-
* @throws {TypeError} if locale is not a string
259258
* @param {URLSearchParams} params
260259
* @private
261260
*/
262261
_applyLocale(params) {
263262
const val = this._config.locale;
264263

265-
if (typeof val !== 'string') {
266-
throw new TypeError('"locale" must be a string');
264+
// If "locale" is not defined, then the "user_culture"
265+
// param is not sent to the app. This tells the app to
266+
// try use the user's default browser language, if it
267+
// is supported by HelloSign. Otherwise, the app falls
268+
// back to English.
269+
if (val && val.length) {
270+
params.append('user_culture', val);
267271
}
268-
269-
params.append('user_culture', val);
270272
}
271273

272274
/**

0 commit comments

Comments
 (0)