i18nUtils

package
v0.0.0-...-c85cc39 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Overview

################################################################################ # Copyright 2019 IBM Corp. All Rights Reserved. # # 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

View Source
const I18nDirectory = "i18n"

Variables

View Source
var Bundle *i18n.Bundle

Bundle i18n bundle holder

Functions

func GetAllLanguageTags

func GetAllLanguageTags() ([]language.Tag, error)

func GetI18nDir

func GetI18nDir() (string, error)

GetI18nDir returns the directory where the i18n files are.

func GetLangs

func GetLangs(req *http.Request) []string

func IsSupportedLanguage

func IsSupportedLanguage(lang string) bool

func LoadMessageFiles

func LoadMessageFiles() error

LoadMessageFiles load translation files located in the <directory where the code is running>/i18n

func LoadTranslationFilesFromDir

func LoadTranslationFilesFromDir(i18nDir string) error

Load into the Bundle with the translation file located in i18nDir

func RestoreFiles

func RestoreFiles() error

RestoreFiles loaded i18nBinData by go-bindata into the <directory where the code is running>/i18n

func Translate

func Translate(key string, defaultTranslation string, langs []string) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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