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
- Variables
- func GetAllLanguageTags() ([]language.Tag, error)
- func GetI18nDir() (string, error)
- func GetLangs(req *http.Request) []string
- func IsSupportedLanguage(lang string) bool
- func LoadMessageFiles() error
- func LoadTranslationFilesFromDir(i18nDir string) error
- func RestoreFiles() error
- func Translate(key string, defaultTranslation string, langs []string) (string, error)
Constants ¶
const I18nDirectory = "i18n"
Variables ¶
var Bundle *i18n.Bundle
Bundle i18n bundle holder
Functions ¶
func GetAllLanguageTags ¶
func GetI18nDir ¶
GetI18nDir returns the directory where the i18n files are.
func IsSupportedLanguage ¶
func LoadMessageFiles ¶
func LoadMessageFiles() error
LoadMessageFiles load translation files located in the <directory where the code is running>/i18n
func LoadTranslationFilesFromDir ¶
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
Types ¶
This section is empty.