Esempio n. 1
0
// Like NGettext(), but looking up the message in the specified domain.
func DNGettext(domainname string, msgid string, msgid_plural string, n uint64) string {
	cdomainname := C.CString(domainname)
	cmsgid := C.CString(msgid)
	cmsgid_plural := C.CString(msgid_plural)

	res := C.GoString(C.dngettext(cdomainname, cmsgid, cmsgid_plural, C.ulong(n)))

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

	return res
}
Esempio n. 2
0
// DNGettext is like NGettext(), but looks up the message in the specified
// domain.
func DNGettext(domainname string, msgid string, msgidPlural string, n uint64) 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.dngettext(cdomainname, cmsgid, cmsgidPlural, C.ulong(n)))
}