-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add internationalization foundation
- Loading branch information
1 parent
9dae148
commit 3264713
Showing
17 changed files
with
289 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset=utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package i18n | ||
|
||
import ( | ||
"embed" | ||
"encoding/json" | ||
|
||
"golang.org/x/text/language" | ||
"golang.org/x/text/message" | ||
) | ||
|
||
type Languages map[string]Messages | ||
|
||
type Messages map[string]string | ||
|
||
var CurrentLanguage = language.English | ||
|
||
//go:embed translations.json | ||
var translations embed.FS | ||
|
||
func LoadTranslations() (Languages, error) { | ||
data, err := translations.ReadFile("translations.json") | ||
if err != nil { | ||
return Languages{}, err | ||
} | ||
|
||
var languages Languages | ||
err = json.Unmarshal(data, &languages) | ||
if err != nil { | ||
return Languages{}, err | ||
} | ||
return languages, nil | ||
} | ||
|
||
func SetupTranslations(translations Languages) error { | ||
for langTag, messages := range translations { | ||
tag, err := language.Parse(langTag) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
for key, translation := range messages { | ||
err := message.SetString(tag, key, translation) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
func Translate(key string) string { | ||
p := message.NewPrinter(CurrentLanguage) | ||
return p.Sprintf(key) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"en": { | ||
"WELCOME": "Welcome to Console!", | ||
"DESCRIPTION": "Your centralized platform for managing Intel® Active Management Technology (AMT) devices within enterprise environments.", | ||
"DETAILEDDESCRIPTION1": "Our console is expertly designed to streamline the administration of AMT-equipped devices, offering a comprehensive suite of out-of-band management features directly over your local network.", | ||
"DETAILEDDESCRIPTION2": "With Console, you gain unparalleled control and visibility over your devices. Explore detailed device information at a glance, initiate secure connections via Keyboard, Video, Mouse (KVM) for real-time interaction, and leverage a range of out-of-band management capabilities to ensure your devices are always performing at their peak, regardless of their power state or operating system status.", | ||
"DETAILEDDESCRIPTION3": "This console is specifically tailored for IT professionals and system administrators in enterprise settings, facilitating direct connections to AMT devices without the need for internet-based interactions. It's the perfect tool for enhancing your operational efficiency, ensuring security, and managing your devices more effectively.", | ||
"DASHBOARD": "Dashboard", | ||
"DEVICES": "Devices", | ||
"CERTIFICATES": "Certificates", | ||
"PROFILES": "Profiles", | ||
"ADDDEVICE": "Add Device", | ||
"DEVICENAME": "Name", | ||
"DEVICEADDRESS": "Device Address", | ||
"CONNECT": "Connect", | ||
"EDIT": "Edit", | ||
"DELETE": "Delete", | ||
"HOSTOSFQDN": "Host OS FQDN", | ||
"AMTUUID": "AMT UUID", | ||
"POWERSTATE": "Power State" | ||
}, | ||
"es": { | ||
"WELCOME": "¡Te damos la bienvenida a la Console!", | ||
"DESCRIPTION": "Su plataforma centralizada para gestionar dispositivos de tecnología Intel® Active Management Technology (AMT) en entornos empresariales.", | ||
"DETAILEDDESCRIPTION1": "Nuestra consola está diseñada por expertos para agilizar la administración de dispositivos equipados con AMT, ofreciendo un conjunto completo de funciones de administración fuera de banda directamente a través de su red local.", | ||
"DETAILEDDESCRIPTION2": "Con Console, obtienes un control y una visibilidad sin precedentes sobre tus dispositivos. Explore la información detallada del dispositivo de un vistazo, inicie conexiones seguras a través de teclado, vídeo y ratón (KVM) para una interacción en tiempo real y aproveche una gama de capacidades de gestión fuera de banda para garantizar que sus dispositivos siempre funcionen al máximo, independientemente de su estado de energía o del estado del sistema operativo.", | ||
"DETAILEDDESCRIPTION3": "Esta consola está diseñada específicamente para profesionales de TI y administradores de sistemas en entornos empresariales, lo que facilita las conexiones directas a dispositivos AMT sin necesidad de interacciones basadas en Internet. Es la herramienta perfecta para mejorar su eficiencia operativa, garantizar la seguridad y administrar sus dispositivos de manera más efectiva.", | ||
"DASHBOARD": "Salpicadero", | ||
"DEVICES": "Dispositivos", | ||
"CERTIFICATES": "Certificados", | ||
"PROFILES": "Perfiles", | ||
"ADDDEVICE": "Agregar dispositivo", | ||
"DEVICENAME": "Nombre", | ||
"DEVICEADDRESS": "Dirección del dispositivo", | ||
"CONNECT": "Conectar", | ||
"EDIT": "Editar", | ||
"DELETE": "Borrar", | ||
"HOSTOSFQDN": "FQDN del sistema operativo host", | ||
"AMTUUID": "AMT UUID", | ||
"POWERSTATE": "Estado de energía" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.