// Translate returns a translate response from the Giphy API
345668
func (c *Client) Translate(args []string) (Translate, error) {
	argsStr := strings.Join(args, " ")

	req, err := c.NewRequest("/gifs/translate?s=" + argsStr)
	if err != nil {
		return Translate{}, err
	}

	var translate Translate
	if _, err = c.Do(req, &translate); err != nil {
		return Translate{}, err
	}

	if len(translate.RawData) == 0 {
		return Translate{}, ErrNoRawData
	}

	// Check if the first character in Data is a [
	if translate.RawData[0] == '[' {
		return Translate{}, ErrNoImageFound
	}

	err = json.Unmarshal(translate.RawData, &translate.Data)
	if err != nil {
		return Translate{}, err
	}

	return translate, nil
}
127900
func (t translator) translate(vFrom, vTo reflect.Value) {
	tFrom := vFrom.Type()
	tTo := vTo.Type()
	if fnv := t.getTranslator(tFrom, tTo); fnv.IsValid() {
		vTo.Set(fnv.Call([]reflect.Value{vFrom})[0])
		return
	}
	if t.translatable(tFrom, tTo) {
		t.translateSameType(vFrom, vTo)
		return
	}

	panic(fmt.Sprintf("Translator not defined for %v to %v", tFrom, tTo))
}
573013
func (p *Painter) Translate(x, y int) {
	p.transforms = append(p.transforms, image.Point{x, y})
}
932411
func (a *ArgoCDServer) translateGrpcCookieHeader(ctx context.Context, w http.ResponseWriter, resp golang_proto.Message) error {
	if sessionResp, ok := resp.(*session.SessionResponse); ok {
		flags := []string{"path=/"}
		if !a.Insecure {
			flags = append(flags, "Secure")
		}
		cookie, err := httputil.MakeCookieMetadata(common.AuthCookieName, sessionResp.Token, flags...)
		if err != nil {
			return err
		}

		w.Header().Set("Set-Cookie", cookie)
	}
	return nil
}
306617
func (l *Language) Get(key string) interface{} {
	local := l.GetLocal(key)
	if local != nil {
		return local
	}
	return l.Cfg.Get(key)
}
315423
func (s nopTranslateStore) TranslateColumnToString(index string, values uint64) (string, error) {
	return "", nil
}
1045709
func translateFunc(arg1, arg2, arg3 query) func(query, iterator) interface{} {
	return func(q query, t iterator) interface{} {
		str := asString(t, arg1.Evaluate(t))
		src := asString(t, arg2.Evaluate(t))
		dst := asString(t, arg3.Evaluate(t))

		var replace []string
		for i, s := range src {
			d := ""
			if i < len(dst) {
				d = string(dst[i])
			}
			replace = append(replace, string(s), d)
		}
		return strings.NewReplacer(replace...).Replace(str)
	}
}
918343
func (i18n *I18n) DeleteTranslation(translation *Translation) (err error) {
	for _, backend := range i18n.Backends {
		backend.DeleteTranslation(translation)
	}

	return i18n.cacheStore.Delete(cacheKey(translation.Locale, translation.Key))
}
1266037
func Transform(extensions map[string]interface{}) map[string]interface{} {
	if extensions == nil {
		return nil
	}
	out := make(map[string]interface{}, len(extensions))
	for name, payload := range extensions {
		transform, ok := transformers[name]
		if !ok {
			// No transformer registered, skip.
			continue
		}
		transformedPayload := transform(payload)
		if transformedPayload == nil {
			// Transformer returned nothing, skip.
			continue
		}
		out[name] = transformedPayload
	}
	return out
}
1096292
func (mat *T) Translate(v *vec2.T) *T {
	mat[2][0] += v[0]
	mat[2][1] += v[1]
	return mat
}
521954
func (orig *FugaJSON) Convert() (*Fuga, error) {
	ret := &Fuga{}

	b := NewFugaJSONBuilder().AddAll()
	for _, info := range b._properties {
		if err := info.Decoder(orig, ret); err != nil {
			return nil, err
		}
	}

	return ret, nil
}
1015577
func Translate2D(Tx, Ty float64) Mat3 {
	return Mat3{1, 0, 0, 0, 1, 0, float64(Tx), float64(Ty), 1}
}
498485
func TranslatedMap(ctx context.Context, sourceInterface interface{}) map[string]interface{} {
	iType := reflect.TypeOf(sourceInterface).Elem()
	result := make(map[string]interface{})

	for i := 0; i < iType.NumField(); i++ {
		fieldName := reflect.TypeOf(sourceInterface).Elem().Field(i).Name
		fieldValue := reflect.ValueOf(sourceInterface).Elem().Field(i).String()

		result[fieldName] = Translate(ctx, fieldValue)
	}

	return result
}
709086
func (tr *Matrix) Translate(tx, ty float64) {
	tr[4] = tx*tr[0] + ty*tr[2] + tr[4]
	tr[5] = ty*tr[3] + tx*tr[1] + tr[5]
}
557983
func Translator(toCharset, fromCharset string, invalid rune) (charset.Translator, error) {
	cto, cfrom := C.CString(toCharset), C.CString(fromCharset)
	cd, err := C.iconv_open(cto, cfrom)

	C.free(unsafe.Pointer(cfrom))
	C.free(unsafe.Pointer(cto))

	if cd == C.iconv_open_error {
		if err == syscall.EINVAL {
			return nil, errors.New("iconv: conversion not supported")
		}
		return nil, err
	}
	t := &iconvTranslator{cd: cd, invalid: invalid}
	runtime.SetFinalizer(t, func(*iconvTranslator) {
		C.iconv_close(cd)
	})
	return t, nil
}
599466
func (c *Client) translateCommon(q string, rating string, urlFragment string) (*Gif, error) {

	// check that a query string was actually passed in
	if len(q) < 1 {
		err := errors.New("`q` parameter must not be empty.")
		return nil, err
	}

	// check that the given rating is valid
	if err := validateRating(rating); err != nil {
		return nil, err
	}

	// build query string that will be appended to url
	qs := &url.Values{}
	qs.Set("s", q)
	if rating != "" {
		qs.Set("rating", rating)
	}

	// construct and execute the HTTP request
	sr := &singleResult{}
	if err := c.makeRequest(urlFragment, qs, sr); err != nil {
		return nil, err
	}

	return sr.Data, nil
}
1308610
func NewTranslation(data map[string]interface{}) (Translation, error) {
	id, ok := data["id"].(string)
	if !ok {
		return nil, fmt.Errorf(`missing "id" key`)
	}
	var pluralObject map[string]interface{}
	switch translation := data["translation"].(type) {
	case string:
		tmpl, err := newTemplate(translation)
		if err != nil {
			return nil, err
		}
		return &singleTranslation{id, tmpl}, nil
	case map[interface{}]interface{}:
		// The YAML parser uses interface{} keys so we first convert them to string keys.
		pluralObject = make(map[string]interface{})
		for k, v := range translation {
			kstr, ok := k.(string)
			if !ok {
				return nil, fmt.Errorf(`invalid plural category type %T; expected string`, k)
			}
			pluralObject[kstr] = v
		}
	case map[string]interface{}:
		pluralObject = translation
	case nil:
		return nil, fmt.Errorf(`missing "translation" key`)
	default:
		return nil, fmt.Errorf(`unsupported type for "translation" key %T`, translation)
	}

	templates := make(map[language.Plural]*template, len(pluralObject))
	for k, v := range pluralObject {
		pc, err := language.NewPlural(k)
		if err != nil {
			return nil, err
		}
		str, ok := v.(string)
		if !ok {
			return nil, fmt.Errorf(`plural category "%s" has value of type %T; expected string`, pc, v)
		}
		tmpl, err := newTemplate(str)
		if err != nil {
			return nil, err
		}
		templates[pc] = tmpl
	}
	return &pluralTranslation{id, templates}, nil
}