From 1759196f26e7a95b21a5b84817f509fd51291438 Mon Sep 17 00:00:00 2001 From: bizcochito Date: Mon, 31 Jan 2022 11:03:58 +0100 Subject: [PATCH] Done and "implemented" locales Language for now is called 1 time and hardcoded. Solved error on todo and made a coment on every lenguage. --- data/locale/{english.lua => ENG.lua} | 2 -- data/scripts.lua | 3 +++ data/scripts/locale.lua | 4 ++++ data/scripts/ui.lua | 7 ++++--- main.lua | 5 +++-- to_do.txt | 8 ++++---- 6 files changed, 18 insertions(+), 11 deletions(-) rename data/locale/{english.lua => ENG.lua} (93%) create mode 100644 data/scripts/locale.lua diff --git a/data/locale/english.lua b/data/locale/ENG.lua similarity index 93% rename from data/locale/english.lua rename to data/locale/ENG.lua index 2ffee8e..8b5e23f 100644 --- a/data/locale/english.lua +++ b/data/locale/ENG.lua @@ -8,5 +8,3 @@ Locale.ui.pause_screen_exit = "Exit" Locale.entity = {} Locale.entity.fairy = {} Locale.entity.fairy.name = "Ozy" - -return Locale diff --git a/data/scripts.lua b/data/scripts.lua index 4d879db..ecc07e7 100644 --- a/data/scripts.lua +++ b/data/scripts.lua @@ -22,3 +22,6 @@ require "data/scripts/ui" require "data/scripts/game" require "data/scripts/gameworld" require "data/scripts/editor" + +-- locale +require "data/scripts/locale" diff --git a/data/scripts/locale.lua b/data/scripts/locale.lua new file mode 100644 index 0000000..8d538f6 --- /dev/null +++ b/data/scripts/locale.lua @@ -0,0 +1,4 @@ +function LocaleLoad(ISO639) + local ISO639 = ISO639 or "ENG" + dofile("Mothback/data/locale/"..ISO639..".lua") +end diff --git a/data/scripts/ui.lua b/data/scripts/ui.lua index 80a0eb2..a3c5989 100644 --- a/data/scripts/ui.lua +++ b/data/scripts/ui.lua @@ -67,7 +67,7 @@ function MenuInit(menu) {false,true}, 1, { - text = "Resume", + text = Locale.ui.pause_screen_resume, color = {0,0,0.5}, color2 = {1,1,1} } @@ -80,7 +80,7 @@ function MenuInit(menu) {false,true}, 1, { - text = "Options", + text = Locale.ui.pause_screen_options, color = {0,0,0.5}, color2 = {1,1,1} } @@ -93,7 +93,7 @@ function MenuInit(menu) {false,true}, 1, { - text = "Exit", + text = Locale.ui.pause_screen_exit, color = {0,0,0.5}, color2 = {1,1,1} } @@ -101,4 +101,5 @@ function MenuInit(menu) end end +UIElement = {} require "data/scripts/ui/button" diff --git a/main.lua b/main.lua index 859310b..11ee09d 100644 --- a/main.lua +++ b/main.lua @@ -13,8 +13,6 @@ function love.load() fps_draw = 0 fps_total = 0 - UIElement = {} - love.graphics.setColor(1,1,1) love.keyboard.setKeyRepeat(true) love.graphics.setDefaultFilter("nearest") -- good pixel @@ -44,6 +42,9 @@ function love.load() LoadedParticles = {} LevelLoadTiles() + language = "ENG" + LocaleLoad(lenguage) + main_Player = Player:New(75,50) --Kupo:New(100,150) diff --git a/to_do.txt b/to_do.txt index 3772705..afd3750 100644 --- a/to_do.txt +++ b/to_do.txt @@ -52,7 +52,7 @@ ( ) Characters ( ) Level design ( ) Translations - ( ) ESP - ( ) ENG - ( ) CAT - ( ) HEN + ( ) SPA "es_ES" + ( ) ENG "en_UK" + ( ) CAT "ca_ES" + ( ) HEN "Myrheonian"