Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Server localization management
October 20, 2023
17:10, EEST
Avatar
Francesco Zambon
Member
Members
Forum Posts: 83
Member Since:
December 20, 2021
sp_UserOfflineSmall Offline

Hello,

please I need clarification regarding the management of the LocalizedTexts.

For example, if a server publishes translations only for the “en-GB” locale, it should also publish translations for the “en” locale (without country)?
After checking documentation, I believe there is no need to do this because the server will try to do “locale best match”

https://reference.opcfoundation.org/v104/Core/docs/Part4/5.6.3/
"If there are no exact matches, then the Server ignores the country/region component of the locale id, and returns the string whose component matches the component of the locale id with the highest priority in the Client supplied list."

I also need confirmation regarding how DefaultText works:

Builder com.prosysopc.ua.stack.builtintypes.LocalizedText.Builder.setDefaultText(String arg0)

Is it correct that the default translations use NO LOCALE (“”)?
If the DefaultText does not have a locale, how does the OPC UA client understand how the text was translated?

I’m using the latest version of the SDK (5.0.2).

Thank you very much for helping,
Francesco

October 23, 2023
13:56, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1026
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

As far as I know, no need to make ‘en’ separately now that we have the “best match” feature in 5.0.2. That was done based on that spec text you also mentioned (https://reference.opcfoundation.org/Core/Part4/v105/docs/5.6.3).

The LocalizedText.Builder.setDefaultText(String) uses NO_LOCALE i.e. Locale.ROOT or empty/null String “localeId” (5.x uses empty string, 4.x used both). This is related to another section of the spec (the “invariant locale” part) : https://reference.opcfoundation.org/Core/Part4/v104/docs/5.10.4.1.
NOTE! You do not have to use this. If invariant locale is not set, then the first text you set via the LocalizedText.Builder is the “default value” in the case of no match at all i.e. this relates to the spec text part ” If there still are no matches, then the Server returns the string that it has along with the locale id. ” in the Part4 section 5.6.3.

Since this is so old text, from OPC UA 1.01 i.e. basically 15 years old, and it hasn’t been used in practice, it is possible there is a contradition. So if you ask “why”, then my answer is sort of “I do not know, no-one has used this feature in 15 years” and https://opcfoundation.org/forum/ might be a better place to ask.

Personally I feel the “best match” logic is kinda a bit not intuitive, but that might also be since my knowledge is limited here. For example, if the client asks en-US, but the server has en-GB, there is a danger that the second index is a direct match and would take precedence, when the user might have wanted “any english”. But maybe the country codes matter more in some other languages.

I think I would need clarifications to the “If the DefaultText does not have a locale, how does the OPC UA client understand how the text was translated?”. Like the answer is “it doesn’t”, but it is unclear why that is a problem i.e. what you would want here and why? It is sort of tied to the “this hasn’t been used in practice”. Typically the value would be just shown as-is. If it is an general client like UaExpert or our UA Browser it would in addition show the localeid part, but it would just be an empty string part if is the NO_LOCALE.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
46 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 734

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1523

Posts: 6449

Newest Members:

christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16, edgardo3518

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1