Hi Rajith,

> 1. Are we creating the text key same as the text to be displayed. (AFAIK
> we have done this in V2 because its easy to translate the json file in to
> another language) or are we using short key values.
>
IMO , We could use the message text as the locale file key if it's shorter
than an agreed length (i:e 20 characters), else we would need to truncate
the message text to use as its key.
I think having a message characters count higher than 30 or 20 would not be
common (other than in some descriptions or so). Most of the transferable
text would be button names, table columns ect.
There is a small drawback when using truncated keys, where if the locale
file is missing as the fallback option
<https://github.com/yahoo/react-intl/wiki/Components#message-formatting-fallbacks>
library will show the *FormattedMessage* id as the text. It would be less
meaningful in that case.

2. Are we using the dot (.) as the delimiter for key values. If the answer
> to the question 1, is to use key as same as the value, we can not use this
> delimiter because we can not include special characters


AFAIK, the only constraint
<https://github.com/yahoo/react-intl/wiki/Components#message-descriptor>
with *id *is, it should be a unique value in locale file, if the id
satisfies that, dot separators (or other special characters) would not be a
problem.

Thanks
~KasunTe

On Wed, Aug 22, 2018 at 10:08 AM Rajith Roshan <[email protected]> wrote:

> Hi all,
> We have added the support  for localization in APIM v3. We have followed
> the format[1] (words separated by dots)when specifying the key for the i18n
> text.
> But when we have lengthy text values , the key is getting longer as in
> [2]. We have followed the same patter in APIM V2 also when specifying the
> key, where the key is similar as the text need to be displayed.
> When we have keys with separated by dota, if the text to be displayed have
> special character like ", or . or ' or etc", we can not incorporate them
> into the key.
> So we need  answers for the following two questions.
>
> 1. Are we creating the text key same as the text to be displayed. (AFAIK
> we have done this in V2 because its easy to translate the json file in to
> another language) or are we using short key values.
> 2. Are we using the dot (.) as the delimiter for key values. If the answer
> to the question 1, is to use key as same as the value, we can not use this
> delimiter because we can not include special characters
>
>
> [1] -
> https://github.com/wso2/carbon-dashboards/blob/master/components/dashboards-web-component/public/locales/en.json
>
> [2] -
> https://github.com/wso2/carbon-apimgt/blob/master/features/apimgt/org.wso2.carbon.apimgt.publisher.feature/src/main/resources/publisher/public/locales/en.json#L9
>
> Thanks!
> Rajith
>
> --
> Rajith Roshan
> Senior Software Engineer, WSO2 Inc.
> Mobile: +94-717-064-214
>


-- 
*Kasun Thennakoon*
Software Engineer
WSO2, Inc.
Mobile:+94 711661919 <javascript:void(0);>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to