Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Juan Pedro M. on January 19, 2017, 07:59:12 pm



Title: DATEEDIT FORMAT attribute localization
Post by: Juan Pedro M. on January 19, 2017, 07:59:12 pm
Hello,
We are in the process of localizing our application forms. In the process we have noticed that the FORMAT attribute is not localizable and we are getting this error:

cc_scan.per:107:43:107:43:error:(-6803) A grammatical error has been found at '%', expecting CHAR_CONST.

We have different FORMAT attributes for Canada in French, English and US English.

Is it possible to localize the FORMAT attribute? or what are some of the solutions? We want to move away from ifdefs and would much prefer to use the built in Genero localization functionality.

Same thing is occurring with the SAMPLE attribute.

Thanks

Juan Pedro Martinez



Title: Re: DATEEDIT FORMAT attribute localization
Post by: Reuben B. on January 23, 2017, 12:04:01 am
Quote
... Is it possible to localize the FORMAT attribute? or what are some of the solutions? ...

... a possible solution is to use DOM Tree manipulation in conjunction with ui.Form.setDefaultInitializer http://4js.com/online_documentation/fjs-fgl-manual-html/#c_fgl_ClassForm_setDefaultInitializer.html to set FORMAT attribute at run-time when form is opened. 
Look for field_format_set in https://github.com/FourjsGenero/fgl_auitree/blob/master/auitree.4gl if you are not sure of DOM Tree manipulation.  I don't have sample example in there but it will be similar, only potential hassle is if the value would get set before the initial sizing of the form.

There is a task FGL-4092 to create a ui.Form.setFieldFormat, contact your local support to be added.  My customer that was looking for that was facing the problem that in Indonesia, currency is typically without any decimal points, whilst Kuwait, currency typically has three decimal points and so needed to change FORMAT at run-time.

I have also seen similar issue with FORMAT for stock quantities.  Different products with different units of measure e.g. length, weight, cases, boxes etc require input to different number of decimal places.

Also note, if you leave FORMAT blank it should use the local settings of the front-end.

Reuben


Title: Re: DATEEDIT FORMAT attribute localization
Post by: Sebastien F. on January 23, 2017, 08:50:28 am
Hello Juan,

Regarding the DATEEDIT formatting, as mentioned by Reuben, instead of using a FORMAT attribute, did you consider to remove it and just let the DBDATE format take place?

It is good news that you plan to use localized strings to internationalize your application.

Pay attention to the character set: If you want to support several languages that do not fit in the same character set, you will have to use UTF-8.

If not yet done, consider reading carefully all topics of this chapter:

http://4js.com/online_documentation/fjs-fgl-manual-html/#c_fgl_localization_001.html

Seb