···251251252252 rsvp.NetworkError ->
253253 case model.lang {
254254- language.BrazillianPortuguese | language.PortugalPortuguese ->
254254+ language.BrazillianPortuguese | language.Portuguese ->
255255 "Conexão não disponível"
256256 _ -> "Connection not available"
257257 }
258258259259 _ ->
260260 case model.lang {
261261- language.BrazillianPortuguese | language.PortugalPortuguese ->
261261+ language.BrazillianPortuguese | language.Portuguese ->
262262 "Ocorreu um erro ao enviar credenciais"
263263 _ -> "An error occurred when sending credentials"
264264 }
+3-3
src/client/language.gleam
···11pub type Language {
22 BrazillianPortuguese
33- PortugalPortuguese
33+ Portuguese
44 English
55 German
66 Spanish
···99pub fn to_flag(lang: Language) {
1010 case lang {
1111 BrazillianPortuguese -> "🇧🇷"
1212- PortugalPortuguese -> "🇵🇹"
1212+ Portuguese -> "🇵🇹"
1313 English -> "🇺🇸"
1414 German -> "🇩🇪"
1515 Spanish -> "🇪🇸"
···2222 English -> "English"
2323 German -> "German"
2424 Spanish -> "Spanish"
2525- PortugalPortuguese -> "Portugal Portuguese"
2525+ Portuguese -> "Portuguese"
2626 }
2727}
+51-31
src/client/page/login.gleam
···11import client/brand
22-import client/language
22+import client/language as lang
33import client/session
44import gleam/json
55import lustre/attribute.{class} as attr
···8181 }
8282}
83838484-pub fn view(model: Model, lang: language.Language) -> element.Element(Msg) {
8484+pub fn view(model: Model, lang: lang.Language) -> element.Element(Msg) {
8585 // Wrapper
8686 let wrapper_attr = [
8787 class("mx-auto max-w-lg h-full"),
8888 class("flex flex-col gap-2 items-center"),
8989 ]
9090+9191+ // Disable button if the any of the fields are empty
9292+ let disabled = model.email == "" || model.password == "" || model.loading
90939194 html.div(wrapper_attr, [
9295 // LOGO AND TITLE -------------------------------------------------------
···9699 brand.title([class("my-0 text-xl text-center")]),
97100 html.small([class("hidden sm:inline text-subtext")], [
98101 html.text(case lang {
9999- language.BrazillianPortuguese | language.PortugalPortuguese ->
102102+ lang.BrazillianPortuguese | lang.Portuguese ->
100103 "Soluções Climáticas Inteligentes"
101101- _ -> "Smart climate solutions"
104104+ lang.English -> "Smart climate solutions"
105105+ lang.German -> "Intelligente Klimalösungen"
106106+ lang.Spanish -> "Soluciones climáticas inteligentes"
102107 }),
103108 ]),
104109 ]),
···110115 html.header([class("hidden mb-4 @md:inline")], [
111116 html.h3([class("my-2 font-bold")], [
112117 html.text(case lang {
113113- language.BrazillianPortuguese | language.PortugalPortuguese ->
118118+ lang.BrazillianPortuguese | lang.Portuguese ->
114119 "Entrar na Plataforma"
115115- _ -> "Join the Platform"
120120+ lang.German -> "Melden Sie sich auf der Plattform an."
121121+ lang.English -> "Join the Platform"
122122+ lang.Spanish -> "Inicia sesión en la plataforma"
116123 }),
117124 ]),
118125119126 html.p([class("text-subtext")], [
120127 html.text(case lang {
121121- language.BrazillianPortuguese | language.PortugalPortuguese ->
128128+ lang.BrazillianPortuguese ->
122129 "Acesse sua conta para gerenciar seus contratos de energia"
123123- _ -> "Access your account to manage your energy contracts"
130130+ lang.Portuguese ->
131131+ "Aceda à sua conta para gerir os seus contratos de energia"
132132+ lang.English ->
133133+ "Access your account to manage your energy contracts"
134134+ lang.German ->
135135+ "Greifen Sie auf Ihr Konto zu, um Ihre Energieverträge zu verwalten."
136136+ lang.Spanish ->
137137+ "Acceda a su cuenta para gestionar sus contratos de energía."
124138 }),
125139 ]),
126140 ]),
···134148 event.on_input(UserTypedEmail),
135149 attr.type_("email"),
136150 attr.value(model.email),
137137- attr.placeholder(case lang {
138138- language.BrazillianPortuguese | language.PortugalPortuguese ->
139139- "usuario@email.com"
140140- _ -> "user@email.com"
151151+ attr.placeholder({
152152+ case lang {
153153+ lang.BrazillianPortuguese -> "usuario"
154154+ lang.English -> "user"
155155+ lang.Portuguese -> "utilizador"
156156+ lang.German -> "benutzer"
157157+ lang.Spanish -> "usuario"
158158+ }
159159+ <> "@email.com"
141160 }),
142161 class("py-1 px-2 bg-gray-100 rounded-md text-subtext"),
143162 class("placeholder:text-gray-400"),
···148167 // Password
149168 html.label([attr.data("field", ""), class("mt-4")], [
150169 html.text(case lang {
151151- language.BrazillianPortuguese | language.PortugalPortuguese ->
152152- "Senha"
153153- _ -> "Password"
170170+ lang.BrazillianPortuguese | lang.Portuguese -> "Senha"
171171+ lang.English -> "Password"
172172+ lang.German -> "Passwort"
173173+ lang.Spanish -> "Contraseña"
154174 }),
155175156176 html.input([
···166186 ]),
167187168188 html.footer([], [
169169- // Login Button
189189+ // Login Button
170190 html.button(
171191 [
192192+ attr.disabled(disabled),
172193 event.on_click(UserClickedSubmit),
173194 attr.aria_busy(model.loading),
174195 class("w-full"),
175175-176176- // Disabled if any of the input fields are empty.
177177- attr.disabled(
178178- model.email == "" || model.password == "" || model.loading,
179179- ),
180196 ],
181197 [html.text("Login")],
182198 ),
183199184184- // Divider
200200+ // Horizontal Ruler
185201 html.hr([class("my-4")]),
186202187187- // Other links
203203+ // Other links like "Forgot my password".
188204 html.div(
189205 [
190206 class("text-sm text-center"),
191191- class("grid grid-cols-1 gap-2 @xs:grid-cols-2"),
207207+ class("grid gap-2"),
208208+ class("grid-cols-1 @xs:grid-cols-2"),
192209 ],
193210 [
194211 // Forgot my password
195212 html.a([], [
196213 html.text(case lang {
197197- language.BrazillianPortuguese | language.PortugalPortuguese ->
198198- "Esqueci a senha"
199199- _ -> "Forgot my password"
214214+ lang.BrazillianPortuguese -> "Esqueci a senha"
215215+ lang.Portuguese -> "Esqueci-me da senha"
216216+ lang.Spanish -> "Olvidé mi contraseña."
217217+ lang.English -> "Forgot my password"
218218+ lang.German -> "Ich habe mein Passwort vergessen."
200219 }),
201220 ]),
202221203203- // Forgot my password
222222+ // Create account
204223 html.a([], [
205224 html.text(case lang {
206206- language.BrazillianPortuguese | language.PortugalPortuguese ->
207207- "Criar Conta"
208208- _ -> "Create account"
225225+ lang.BrazillianPortuguese | lang.Portuguese -> "Criar Conta"
226226+ lang.Spanish -> "Crear cuenta"
227227+ lang.German -> "Benutzerkonto erstellen"
228228+ lang.English -> "Create account"
209229 }),
210230 ]),
211231 ],
+1-1
src/client/page/navbar.gleam
···5858 let id = "lang-selection"
5959 // Avalable languages
6060 let languages = [
6161- lang.PortugalPortuguese,
6161+ lang.Portuguese,
6262 lang.BrazillianPortuguese,
6363 lang.English,
6464 lang.German,
+1-1
test/page/navbar_test.gleam
···1010 let model = dummy.model(session.Guest, route.Home)
11111212 let languages = [
1313- lang.PortugalPortuguese,
1313+ lang.Portuguese,
1414 lang.BrazillianPortuguese,
1515 lang.English,
1616 lang.German,