You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[GNU gettext utilities](https://www.gnu.org/software/gettext) for Go.
10
+
[GNU gettext utilities](https://www.gnu.org/software/gettext) for Go.
10
11
11
12
12
13
# Features
@@ -17,8 +18,8 @@
17
18
- Support for variables inside translation strings using Go's [fmt syntax](https://golang.org/pkg/fmt/).
18
19
- Support for [pluralization rules](https://www.gnu.org/software/gettext/manual/html_node/Translating-plural-forms.html).
19
20
- Support for [message contexts](https://www.gnu.org/software/gettext/manual/html_node/Contexts.html).
20
-
- Support for MO files.
21
-
- Thread-safe: This package is safe for concurrent use across multiple goroutines.
21
+
- Support for MO files.
22
+
- Thread-safe: This package is safe for concurrent use across multiple goroutines.
22
23
- It works with UTF-8 encoding as it's the default for Go language.
23
24
- Unit tests available.
24
25
- Language codes are automatically simplified from the form `en_UK` to `en` if the first isn't available.
@@ -37,15 +38,15 @@
37
38
Refer to the Godoc package documentation at (https://godoc.org/github.com/leonelquinteros/gotext)
38
39
39
40
40
-
# Installation
41
+
# Installation
41
42
42
43
```
43
44
go get github.com/leonelquinteros/gotext
44
45
```
45
46
46
-
- There are no requirements or dependencies to use this package.
47
+
- There are no requirements or dependencies to use this package.
47
48
- No need to install GNU gettext utilities (unless specific needs of CLI tools).
48
-
- No need for environment variables. Some naming conventions are applied but not needed.
49
+
- No need for environment variables. Some naming conventions are applied but not needed.
49
50
50
51
51
52
## Version vendoring
@@ -103,19 +104,19 @@ Refer to it as gotext.
103
104
104
105
# Locales directories structure
105
106
106
-
The package will assume a directories structure starting with a base path that will be provided to the package configuration
107
-
or to object constructors depending on the use, but either will use the same convention to lookup inside the base path.
107
+
The package will assume a directories structure starting with a base path that will be provided to the package configuration
108
+
or to object constructors depending on the use, but either will use the same convention to lookup inside the base path.
108
109
109
-
Inside the base directory where will be the language directories named using the language and country 2-letter codes (en_US, es_AR, ...).
110
-
All package functions can lookup after the simplified version for each language in case the full code isn't present but the more general language code exists.
111
-
So if the language set is `en_UK`, but there is no directory named after that code and there is a directory named `en`,
112
-
all package functions will be able to resolve this generalization and provide translations for the more general library.
110
+
Inside the base directory where will be the language directories named using the language and country 2-letter codes (en_US, es_AR, ...).
111
+
All package functions can lookup after the simplified version for each language in case the full code isn't present but the more general language code exists.
112
+
So if the language set is `en_UK`, but there is no directory named after that code and there is a directory named `en`,
113
+
all package functions will be able to resolve this generalization and provide translations for the more general library.
113
114
114
-
The language codes are assumed to be [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) codes (2-letter codes).
115
+
The language codes are assumed to be [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) codes (2-letter codes).
115
116
That said, most functions will work with any coding standard as long the directory name matches the language code set on the configuration.
116
117
117
-
Then, there can be a `LC_MESSAGES` containing all PO files or the PO files themselves.
118
-
A library directory structure can look like:
118
+
Then, there can be a `LC_MESSAGES` containing all PO files or the PO files themselves.
119
+
A library directory structure can look like:
119
120
120
121
```
121
122
/path/to/locales
@@ -140,7 +141,7 @@ A library directory structure can look like:
0 commit comments