https://github.com/halsten-dev/lokyn
Lokyn is a simple lib to allow for easy localized applications developpement
https://github.com/halsten-dev/lokyn
Last synced: 5 months ago
JSON representation
Lokyn is a simple lib to allow for easy localized applications developpement
- Host: GitHub
- URL: https://github.com/halsten-dev/lokyn
- Owner: halsten-dev
- License: mit
- Created: 2025-08-15T13:33:33.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-08-15T15:53:40.000Z (5 months ago)
- Last Synced: 2025-08-15T17:19:56.197Z (5 months ago)
- Language: Go
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lokyn
Lokyn is a simple lib to allow for easy localized applications developpement.
Heavily inspired by Fyne lang package bit with more of a standalone philosophy.
## main.go
```go
package main
import (
"embed"
"fmt"
"github.com/halsten-dev/lokyn"
"log"
)
//go:embed translations
var translations embed.FS
func main() {
lokyn.Init()
err := lokyn.AddTranslationFS(translations, "translations")
if err != nil {
log.Fatal(err)
}
lokyn.SetLanguage("en")
fmt.Println(lokyn.L("translate"))
fmt.Println(lokyn.P("apple", 2))
}
```
## projects structure
```
project root /
translations /
en.json
fr.json
```
## en.json
```json
{
"translation": "translation",
"apple": {
"one": "apple",
"other": "apples"
}
}
```
## fr.json
```json
{
"translation": "traduction",
"apple": {
"one": "pomme",
"other": "pommes"
}
}
```