common

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TEMPLATED_STRING_REGEXP    = `\{\{\.[[:alnum:][:punct:][:print:]]+?\}\}`
	INTERPOLATED_STRING_REGEXP = `%(?:[#v]|[%EGUTXbcdefgopqstvx])`
)

Variables

View Source
var BLANKS = []string{", ", "\t", "\n", "\n\t", "\t\n"}

Functions

func CheckFile

func CheckFile(fileName string) (string, string, error)

func ConvertToTemplatedString

func ConvertToTemplatedString(aString string) string

func CopyFileContents

func CopyFileContents(src, dst string) error

func CopyI18nStringInfoMap

func CopyI18nStringInfoMap(i18nStringInfoMap map[string]I18nStringInfo) map[string]I18nStringInfo

func CreateI18nStringInfoMap

func CreateI18nStringInfoMap(i18nStringInfos []I18nStringInfo) (map[string]I18nStringInfo, error)

func CreateOutputDirsIfNeeded

func CreateOutputDirsIfNeeded(outputDirname string) error

func CreateTmpFile

func CreateTmpFile(content string) (*os.File, error)

func FindFilePath

func FindFilePath(filename string) (string, error)

func GetAbsFileInfo

func GetAbsFileInfo(fileNamePath string) (os.FileInfo, error)

func GetTemplatedStringArgs

func GetTemplatedStringArgs(aString string) []string

func ImportsForASTFile

func ImportsForASTFile(astFile *ast.File) (*ast.GenDecl, error)

func IsInterpolatedString

func IsInterpolatedString(aString string) bool

func IsTemplatedString

func IsTemplatedString(aString string) bool

func ParseStringList

func ParseStringList(stringList string, delimiter string) []string

func SaveI18nStringInfos

func SaveI18nStringInfos(printer PrinterInterface, options Options, i18nStringInfos []I18nStringInfo, fileName string) error

func SaveI18nStringsInPo

func SaveI18nStringsInPo(printer PrinterInterface, options Options, i18nStrings []I18nStringInfo, fileName string) error

func SaveStrings

func SaveStrings(printer PrinterInterface, options Options, stringInfos map[string]StringInfo, outputDirname string, fileName string) error

func SaveStringsInPo

func SaveStringsInPo(printer PrinterInterface, options Options, stringInfos map[string]StringInfo, outputDirname string, fileName string) error

func UnescapeHTML

func UnescapeHTML(byteArray []byte) []byte

Types

type ExcludedStrings

type ExcludedStrings struct {
	ExcludedStrings []string `json:"excludedStrings"`
	ExcludedRegexps []string `json:"excludedRegexps"`
}

type I18nStringInfo

type I18nStringInfo struct {
	ID          string `json:"id"`
	Translation string `json:"translation"`
	Modified    bool   `json:"modified"`
}

func I18nStringInfoMapValues2Array

func I18nStringInfoMapValues2Array(i18nStringInfosMap map[string]I18nStringInfo) []I18nStringInfo

func LoadI18nStringInfos

func LoadI18nStringInfos(fileName string) ([]I18nStringInfo, error)

type Options

type Options struct {
	CommandFlag string

	HelpFlag     bool
	LongHelpFlag bool

	VerboseFlag bool
	DryRunFlag  bool
	PoFlag      bool
	MetaFlag    bool

	SourceLanguageFlag        string
	LanguagesFlag             string
	GoogleTranslateApiKeyFlag string

	OutputDirFlag          string
	OutputMatchImportFlag  bool
	OutputMatchPackageFlag bool
	OutputFlatFlag         bool

	ExcludedFilenameFlag string
	FilenameFlag         string
	DirnameFlag          string

	RecurseFlag bool

	IgnoreRegexpFlag string

	LanguageFilesFlag string

	I18nStringsFilenameFlag string
	I18nStringsDirnameFlag  string

	RootPathFlag string

	InitCodeSnippetFilenameFlag string

	QualifierFlag string
}

type PrinterInterface

type PrinterInterface interface {
	Println(a ...interface{}) (int, error)
	Printf(msg string, a ...interface{}) (int, error)
}

type StringInfo

type StringInfo struct {
	Filename string `json:"filename"`
	Value    string `json:"value"`
	Offset   int    `json:"offset"`
	Line     int    `json:"line"`
	Column   int    `json:"column"`
}

Jump to

Keyboard shortcuts

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