github.com/liquid-dev/text@v0.3.3-liquid/message/pipeline/testdata/test1/catalog_gen.go (about)

     1  // Code generated by running "go generate" in github.com/liquid-dev/text. DO NOT EDIT.
     2  
     3  package main
     4  
     5  import (
     6  	"github.com/liquid-dev/text/language"
     7  	"github.com/liquid-dev/text/message"
     8  	"github.com/liquid-dev/text/message/catalog"
     9  )
    10  
    11  type dictionary struct {
    12  	index []uint32
    13  	data  string
    14  }
    15  
    16  func (d *dictionary) Lookup(key string) (data string, ok bool) {
    17  	p := messageKeyToIndex[key]
    18  	start, end := d.index[p], d.index[p+1]
    19  	if start == end {
    20  		return "", false
    21  	}
    22  	return d.data[start:end], true
    23  }
    24  
    25  func init() {
    26  	dict := map[string]catalog.Dictionary{
    27  		"de":    &dictionary{index: deIndex, data: deData},
    28  		"en_US": &dictionary{index: en_USIndex, data: en_USData},
    29  		"zh":    &dictionary{index: zhIndex, data: zhData},
    30  	}
    31  	fallback := language.MustParse("en-US")
    32  	cat, err := catalog.NewFromMap(dict, catalog.Fallback(fallback))
    33  	if err != nil {
    34  		panic(err)
    35  	}
    36  	message.DefaultCatalog = cat
    37  }
    38  
    39  var messageKeyToIndex = map[string]int{
    40  	"%.2[1]f miles traveled (%[1]f)":                 8,
    41  	"%[1]s is visiting %[3]s!\n":                     3,
    42  	"%d files remaining!":                            4,
    43  	"%d more files remaining!":                       5,
    44  	"%s is out of order!":                            7,
    45  	"%s is visiting %s!\n":                           2,
    46  	"Hello %s!\n":                                    1,
    47  	"Hello world!\n":                                 0,
    48  	"Use the following code for your discount: %d\n": 6,
    49  }
    50  
    51  var deIndex = []uint32{ // 10 elements
    52  	0x00000000, 0x00000011, 0x00000023, 0x0000003d,
    53  	0x00000057, 0x00000075, 0x00000094, 0x00000094,
    54  	0x00000094, 0x00000094,
    55  } // Size: 64 bytes
    56  
    57  const deData string = "" + // Size: 148 bytes
    58  	"\x04\x00\x01\x0a\x0c\x02Hallo Welt!\x04\x00\x01\x0a\x0d\x02Hallo %[1]s!" +
    59  	"\x04\x00\x01\x0a\x15\x02%[1]s besucht %[2]s!\x04\x00\x01\x0a\x15\x02%[1]" +
    60  	"s besucht %[3]s!\x02Noch zwei Bestände zu gehen!\x02Noch %[1]d Bestände " +
    61  	"zu gehen!"
    62  
    63  var en_USIndex = []uint32{ // 10 elements
    64  	0x00000000, 0x00000012, 0x00000024, 0x00000042,
    65  	0x00000060, 0x00000077, 0x000000ba, 0x000000ef,
    66  	0x00000106, 0x00000125,
    67  } // Size: 64 bytes
    68  
    69  const en_USData string = "" + // Size: 293 bytes
    70  	"\x04\x00\x01\x0a\x0d\x02Hello world!\x04\x00\x01\x0a\x0d\x02Hello %[1]s!" +
    71  	"\x04\x00\x01\x0a\x19\x02%[1]s is visiting %[2]s!\x04\x00\x01\x0a\x19\x02" +
    72  	"%[1]s is visiting %[3]s!\x02%[1]d files remaining!\x14\x01\x81\x01\x00" +
    73  	"\x02\x14\x02One file remaining!\x00&\x02There are %[1]d more files remai" +
    74  	"ning!\x04\x00\x01\x0a0\x02Use the following code for your discount: %[1]" +
    75  	"d\x02%[1]s is out of order!\x02%.2[1]f miles traveled (%[1]f)"
    76  
    77  var zhIndex = []uint32{ // 10 elements
    78  	0x00000000, 0x00000000, 0x00000000, 0x00000000,
    79  	0x00000000, 0x00000000, 0x00000000, 0x00000000,
    80  	0x00000000, 0x00000000,
    81  } // Size: 64 bytes
    82  
    83  const zhData string = ""
    84  
    85  // Total table size 633 bytes (0KiB); checksum: 74B32E70