GWT number constants generator ?!!

107 views
Skip to first unread message

Ahmad Bawaneh

unread,
Jan 3, 2020, 4:17:03 PM1/3/20
to GWT Contributors
Dears

I am trying to figure out a way to generate and update GWT number constants, looking around i could not find the tool that generates those number constants properties files, they are being generated using an external tool that is not present in the GWT repo.

Now since i could not find the tool i decided to work on GWT CLDR importer tool to add a NumberConstants generator, i was able to read cldr data and generated classes for some of the attributes from the original properties file, but then i faced a problem where some of those attribute was pretty clear where to find in the CLDR data but for some other i was unable to find anything to lead me on how they were originally generated

properties i was able to find in the cldr data and generate the proper code for 
------------------------------------------------------------------------------------------------------
decimalSeparator
groupingSeparator
percent
plusSign
minusSign
exponentialSymbol
perMill
infinity
notANumber
currencyPattern
decimalPattern
scientificPattern
percentPattern

Properties that i cant figure out where to find or how to generate at all
--------------------------------------------------------------------------------------------
simpleCurrencyPattern
monetarySeparator
monetaryGroupingSeparator
globalCurrencyPattern
defCurrencyCode
zeroDigit


for some reason i feel like this is related to the same issue with TimeZone constants as mentioned in this thread https://groups.google.com/forum/#!topic/google-web-toolkit-contributors/VN4ATVrLrTA

I will appreciate any help as this is one of the things that is delaying the release of GWT 3.0

the tool that i use to generate CLDR related classes is here https://github.com/vegegoku/gwt-cldr-importer which is bases on the GWT tools.

thanks

Goktug Gokdogan

unread,
Jan 6, 2020, 6:30:32 PM1/6/20
to google-web-toolkit-contributors
I'm not familiar with this but looking at the internal tool, it looks like;

zeroDigit data is coming from "commmon/upplemental/numberingSystems.xml". 
defCurrencyCode is coming from "common/supplemental/supplementalData.xml".
monetarySeparator is under "numbers/symbols/decimal" locale data.
monetaryGroupingSeparator is under "numbers/symbols/group" locale data.
currency patterns are coming from the currencyFormats section of locale data.

Logic for simpleCurrencyPattern:

def CreateSimpleCurrencyPattern(ref_pattern):
  """Return simple currency pattern.

  Before this pattern is available in CLDR, created based on general currency
  pattern by applying this transformation:
  \\00a4+ ==> \\u00a4\\u00a4\\u00a4\\u00a4

  Args:
    ref_pattern: pattern to unescape to create the simple pattern
  Returns:
    simple currency pattern.
  """
  return re.sub(ur'\u00a4+', ur'\u00a4\u00a4\u00a4\u00a4', ref_pattern, 0)

Logic for globalCurrencyPattern:

def CreateGlobalCurrencyPattern(ref_pattern):
  """Return global currency pattern.

  Before this pattern is available in CLDR, created based on simple currency
  pattern.

  Args:
    ref_pattern: pattern to escape to create the global pattern
  Returns:
    the global currency pattern
  """
  simple_pattern = CreateSimpleCurrencyPattern(ref_pattern)
  global_pattern = ''
  in_quote = False
  for ch in simple_pattern:
    if ch == '\'':
      in_quote = not in_quote
    elif ch == ';' and not in_quote:
      global_pattern += ur' \u00a4\u00a4'
    global_pattern += ch
  global_pattern += ur' \u00a4\u00a4'
  return global_pattern


--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/f4887884-3de3-42d6-a39b-ea1faefb580c%40googlegroups.com.

Ahmad Bawaneh

unread,
Jan 7, 2020, 2:13:51 AM1/7/20
to GWT Contributors
Thank you so much for the reply, this is really very helpful.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages