golang.org/x/text@v0.14.0/message/pipeline/testdata/test1/catalog_gen.go.want (about)

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