cindy

SDK setLanguage changes

0 votes
Hi, we upgrade SDK to 11.25 (was using 11.0.2), we noticed that the locale has been changed in 11.0.2, when we sent 'fr-CA' to SDK, SDK will translate to api package as 'fr' in 11.25 when we sent the same request, SDK translate to api package as 'fr-CA' which is not recognized so the package language is 'en' not 'fr' as expected could you please confirm the changes in 11.25 sdk? also if we want to create package in french, what should we send to sdk now? thanks, Cindy

Reply to: SDK setLanguage changes

0 votes
I noticed that the changes in toAPIPackage method New(11.25): if (sdkPackage.getLanguage() != null) { String languageCountry = sdkPackage.getLanguage().getCountry(); result.setLanguage(sdkPackage.getLanguage().getLanguage() + (isNotBlank(languageCountry) ? "-" + languageCountry : EMPTY)); } Old(11.0.2): if ( sdkPackage.getLanguage() != null ) { result.setLanguage(sdkPackage.getLanguage().getLanguage()); } what's purpose for the changes?

Reply to: SDK setLanguage changes

0 votes
Hi Cindy, This code change in SDK was aimed at solving the language issue of zh-CN vs zh-TW (simplified vs traditional Chinese). Before, because SDK can only output the language (zh/fr), there's no option to attach the extra code after it. So with the updated SDK code, you have to combine those Locale instances with country code to the one without country code like to category Locale.CANADA_FRENCH as Locale.FRENCH. Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: SDK setLanguage changes

0 votes
Hi Duo, we set to Locale.CANADA_FRENCH in our package request and when we calling sdk createPackageOneStep , and in toAPIPackage() method of DocumentPackageConverter class if (sdkPackage.getLanguage() != null) { String languageCountry = sdkPackage.getLanguage().getCountry(); result.setLanguage(sdkPackage.getLanguage().getLanguage() + (isNotBlank(languageCountry) ? "-" + languageCountry : EMPTY)); } the sdk set language as 'fr-CA', but once package created, the package language is 'en' instead of 'fr', why does it happened? Thanks, Cindy

Reply to: SDK setLanguage changes

0 votes
Hi Cindy, This is because when the SDK code get updated, the OneSpan Sign backend wasn't get updated in a manner that can handle all the country code (the only acceptable case is zh-CN and zh-TW), so the system still doesn't recognize "fr-CA" and only accepts "fr". Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: SDK setLanguage changes

0 votes
I see. does it consider a bug?

Reply to: SDK setLanguage changes

0 votes
Hi Duo, when you said the system doesn't recognize 'fr-CA', you mean Saas version of system, right? I just want to make sure if there is any setup we can configure in our on-prem env. thanks, Cindy

Reply to: SDK setLanguage changes

0 votes
Hi Cindy, I've checked the source code in OneSpan Sign backend, there's a hard coded list that regulates the accepted Locale instances. Yes, we can try to report it to support team, however, I believe a quicker workaround is to add some custom logic when setting language using SDK:
	private Locale convertLocale(Locale locale) {
		String country = locale.getCountry();
		String language = locale.getLanguage();
		if(!country.isEmpty() && !"zh".equals(language)) {
			return new Locale(language,"");
		}
		return locale;
	}
Regards, Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: SDK setLanguage changes

0 votes
Thanks Duo for information. please report it to support team and copy me as well so I can get further information on that. by the way, from your code sample, if country is not empty and language is not 'zh' which is my case because we send as 'fr_CA'', it will return new locale with language only which is 'fr', why is not working? Cindy

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off