Example #1
0
// NGettext attempts to translate a text string into the user's system
// language, by looking up the appropriate plural form of the translation in a
// message catalog.
func NGettext(msgid string, msgidPlural string, n uint64) string {
	cmsgid := C.CString(msgid)
	defer C.free(unsafe.Pointer(cmsgid))

	cmsgidPlural := C.CString(msgidPlural)
	defer C.free(unsafe.Pointer(cmsgidPlural))

	return C.GoString(C.ngettext(cmsgid, cmsgidPlural, C.ulong(n)))
}
Example #2
0
// Attempt to translate a text string into the user's native language, by
// looking up the appropriate plural form of the translation in a message
// catalog.
func NGettext(msgid string, msgid_plural string, n uint64) string {
	cmsgid := C.CString(msgid)
	cmsgid_plural := C.CString(msgid_plural)

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

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

	return res
}