translation

package
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 11 Imported by: 0

README

Go Report Card GoDoc GolangCI

xmodules/translation for Xamboo - GO

The translation package is used to keep translation tables for any text in your system. The translations can be applied to tables, or random texts. The module asks to google translate to translate automatically any missing text. Any UTF8 text can be translated to any other language.

Version Changes Control

v0.0.1 - 2020-05-08

  • Compatible with xmodule context standard

v0.0.0 - 2020-03-05

  • Support for multithread context implemented

v0.0.0 - 2020-01-03

  • This document added
  • Need xmodules/context to work
  • Need xmodules/user or userlink to work
  • Improvements in creation of modules and tables

v0.0.0 - 2019-12-18

  • First release of module

Manual:

I. Translation

Intro


  1. Overview

Example:

import "github.com/webability-go/xmodules/translation"


  1. Reference

To use the package:

import "github.com/webability-go/xmodules/translation"

Documentation

Overview

Package user contains the list of administrative user for the system. All users have accesses, into a profile and even extended access based upon table records. It needs base xmodule.

Index

Constants

View Source
const (
	SOURCETABLE = 1
	SOURCEFILE  = 2
)

Variables

View Source
var ModuleEntries = assets.ModuleEntries{
	TranslateOne: TranslateOne,
}

Functions

func AddTheme

func AddTheme(sitecontext applications.Datasource, theme string, name string, source int, link string, fields string) error

func GetTranslation

func GetTranslation(sitecontext applications.Datasource, textooriginal string, theme string, key string, field string, lang language.Tag) (string, bool, time.Time, int)

return: translation, ok (true, false), lastdate, lastverified (0, 1, 2) ok = true: texto correcto, false = no existe el texto last date = fecha en la cual se tradujo ( si no es español y ok = true) lastverified = 0: auto (o español original), 1 = verified, 2 = original modified (not re-translated, pending)

func GoogleTranslation

func GoogleTranslation(data []string, fromLang language.Tag, toLang language.Tag) ([]translate.Translation, error)

Las credenciales de conección de google estan dentro del directorio accesible por GO en el archivo JSON de credenciales service_account

func SetTranslation

func SetTranslation(sitecontext applications.Datasource, textotraducido string, theme string, key string, field string, lang language.Tag, verified int) error

return: error

func SetVerified

func SetVerified(sitecontext applications.Datasource, theme string, key string, field string, lang language.Tag, verified int) error

return: error

func Setup

func Setup(ds applications.Datasource, prefix string) ([]string, error)

InitModule is called during the init phase to link the module with the system adds tables and caches to ctx::database

func StartContext

func StartContext(ds applications.Datasource, ctx *context.Context) error

func Synchronize

func Synchronize(ds applications.Datasource, prefix string) ([]string, error)

func Translate

func Translate(sitecontext applications.Datasource, theme string, key string, maindata xdominion.XRecordDef, fields map[string]interface{}, fromLang language.Tag, toLang language.Tag)

All purpose Translation method for structures Any MAINDATA record MUST have a lastmodif field

func TranslateOne added in v0.0.16

func TranslateOne(input string) (string, error)

Types

type TranslationBlock

type TranslationBlock struct {
	// contains filtered or unexported fields
}

func NewTranslationBlock

func NewTranslationBlock(tema string, clave string, lastmodif time.Time, fromlang language.Tag, tolang language.Tag) *TranslationBlock

func (*TranslationBlock) Get

func (tb *TranslationBlock) Get(field string) string

func (*TranslationBlock) Set

func (tb *TranslationBlock) Set(field string, value string)

func (*TranslationBlock) Verify

func (tb *TranslationBlock) Verify(sitecontext applications.Datasource)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL