Пример #1
0
// Like NGettext(), but looking up the message in the specified domain and
// category.
func DCNGettext(domainname string, msgid string, msgid_plural string, n uint64, category uint) string {
	cdomainname := C.CString(domainname)
	cmsgid := C.CString(msgid)
	cmsgid_plural := C.CString(msgid_plural)

	res := C.GoString(C.dcngettext(cdomainname, cmsgid, cmsgid_plural, C.ulong(n), C.int(category)))

	C.free(unsafe.Pointer(cdomainname))
	C.free(unsafe.Pointer(cmsgid))
	C.free(unsafe.Pointer(cmsgid_plural))

	return res
}
Пример #2
0
// DCNGettext is like NGettext(), but looks up the message in the specified
// domain and category.
func DCNGettext(domainname string, msgid string, msgidPlural string, n uint64, category uint) string {
	cdomainname := cDomainName(domainname)
	cmsgid := C.CString(msgid)
	cmsgidPlural := C.CString(msgidPlural)

	defer func() {
		C.free(unsafe.Pointer(cdomainname))
		C.free(unsafe.Pointer(cmsgid))
		C.free(unsafe.Pointer(cmsgidPlural))
	}()

	return C.GoString(C.dcngettext(cdomainname, cmsgid, cmsgidPlural, C.ulong(n), C.int(category)))
}