locale

package
v0.0.0-...-202847b Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package locale provides locale specific services like formatting or translating.

Contains logic to handle currency and number formatting based on locale. Provides access to locale information translated into given languages. Manages locale information for a store instance.

Index

Constants

This section is empty.

Variables

View Source
var AllowedCurrencies = slices.String{}/* 170 elements not displayed */

AllowedCurrencies lists all allowed currencies. You may modify this variable.

View Source
var AllowedLocales = slices.String{
	"af_ZA",
	"ar_DZ",
	"ar_EG",
	"ar_KW",
	"ar_MA",
	"ar_SA",
	"az_Latn_AZ",
	"be_BY",
	"bg_BG",
	"bn_BD",
	"bs_Latn_BA",
	"ca_ES",
	"cs_CZ",
	"cy_GB",
	"da_DK",
	"de_AT",
	"de_CH",
	"de_DE",
	"el_GR",
	"en_AU",
	"en_CA",
	"en_GB",
	"en_NZ",
	"en_US",
	"es_AR",
	"es_CO",
	"es_PA",
	"gl_ES",
	"es_CR",
	"es_ES",
	"es_MX",
	"eu_ES",
	"es_PE",
	"et_EE",
	"fa_IR",
	"fi_FI",
	"fil_PH",
	"fr_CA",
	"fr_FR",
	"gu_IN",
	"he_IL",
	"hi_IN",
	"hr_HR",
	"hu_HU",
	"id_ID",
	"is_IS",
	"it_CH",
	"it_IT",
	"ja_JP",
	"ka_GE",
	"km_KH",
	"ko_KR",
	"lo_LA",
	"lt_LT",
	"lv_LV",
	"mk_MK",
	"mn_Cyrl_MN",
	"ms_Latn_MY",
	"nl_NL",
	"nb_NO",
	"nn_NO",
	"pl_PL",
	"pt_BR",
	"pt_PT",
	"ro_RO",
	"ru_RU",
	"sk_SK",
	"sl_SI",
	"sq_AL",
	"sr_Cyrl_RS",
	"sv_SE",
	"sw_KE",
	"th_TH",
	"tr_TR",
	"uk_UA",
	"vi_VN",
	"zh_Hans_CN",
	"zh_Hant_HK",
	"zh_Hant_TW",
	"es_CL",
	"lo_LA",
	"es_VE",
	"en_IE",
}

AllowedLocales lists all allowed default locales. You may modify this variable.

Functions

func ExtractNumber

func ExtractNumber(n string) (float64, error)

ExtractNumber returns the first found number from a string.

Examples for input:

'  2345.4356,1234' = 23455456.1234
'+23,3452.123' = 233452.123
' 12343 ' = 12343
'-9456km' = -9456
'0' = 0
'2 054,10' = 2054.1
'2'054.52' = 2054.52
'2,46 GB' = 2.46

func FormatPrice

func FormatPrice()

FormatPrice returns price formatting information for a given locale. @todo implement and use github.com/leekchan/accounting

Types

This section is empty.

Jump to

Keyboard shortcuts

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