i18n

package module
v0.0.0-...-9682600 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2017 License: MIT Imports: 5 Imported by: 0

README

i18n

http://pology.nedohodnik.net/doc/user/en_US/ch-poformat.html

msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2014-01-26 10:00+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <example@example.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0\n"
"Language-Code: en\n"
"Language-Name: English\n"
"Preferred-Encodings: utf-8 latin1\n"
"Domain: DOMAIN\n"

#. Default: "Comment here"
#: ./etc/a/file.ext:55
msgid "description_content_here"
msgstr "hello, %v"

# msg with context
#: ./skins/archetypesmultilingual/at_babel_edit.cpt:95
msgctxt "context_a"
msgid "some key"
msgstr "some value"
import (
	"github.com/gabstv/i18n/po/poutil"	
)

func main(){
	provider, err := poutil.LoadAll("path/to/root/translations/dir", "en")
	if err := nil {
		panic(err)
	}
	print(provider.L("en").T("description_content_here", "world") + "\n")
	print(provider.L("en").Ctx("context_a")("some key") + "\n")
}

Documentation

Overview

Copyright ©2015 The Go Authors Copyright ©2015 Steve Francia <spf@spf13.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Walk

func Walk(fs Fs, root string, walkFn filepath.WalkFunc) error

Types

type File

type File interface {
	io.Closer
	io.Reader
	io.ReaderAt
	io.Seeker
	io.Writer
	io.WriterAt

	Name() string
	Readdir(count int) ([]os.FileInfo, error)
	Readdirnames(n int) ([]string, error)
	Stat() (os.FileInfo, error)
	Sync() error
	Truncate(size int64) error
	WriteString(s string) (ret int, err error)
}

File represents a file in the filesystem.

type Fs

type Fs interface {
	// Create creates a file in the filesystem, returning the file and an
	// error, if any happens.
	Create(name string) (File, error)

	// Mkdir creates a directory in the filesystem, return an error if any
	// happens.
	Mkdir(name string, perm os.FileMode) error

	// MkdirAll creates a directory path and all parents that does not exist
	// yet.
	MkdirAll(path string, perm os.FileMode) error

	// Open opens a file, returning it or an error, if any happens.
	Open(name string) (File, error)

	// OpenFile opens a file using the given flags and the given mode.
	OpenFile(name string, flag int, perm os.FileMode) (File, error)

	// Remove removes a file identified by name, returning an error, if any
	// happens.
	Remove(name string) error

	// RemoveAll removes a directory path and any children it contains. It
	// does not fail if the path does not exist (return nil).
	RemoveAll(path string) error

	// Rename renames a file.
	Rename(oldname, newname string) error

	// Stat returns a FileInfo describing the named file, or an error, if any
	// happens.
	Stat(name string) (os.FileInfo, error)

	// The name of this FileSystem
	Name() string

	//Chmod changes the mode of the named file to mode.
	Chmod(name string, mode os.FileMode) error

	//Chtimes changes the access and modification times of the named file
	Chtimes(name string, atime time.Time, mtime time.Time) error
}

Fs is the filesystem interface.

Any simulated or real filesystem should implement this interface.

func OsFS

func OsFS() Fs

type Language

type Language interface {
	Meta(key string) string
	Ctx(ctx string) func(id string, v ...interface{}) string
	T(id string, v ...interface{}) string
}

type Provider

type Provider interface {
	L(code string) Language
	LanguageCodes() []string
}

Directories

Path Synopsis
po

Jump to

Keyboard shortcuts

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