Overarching changes to language changing, not definitive since I'm pondering other alternatives (separate files vs translation files, variables vs functions)

This commit is contained in:
2026-02-16 21:08:36 -03:00
parent 14866f6b25
commit 04dca92778
29 changed files with 839 additions and 1884 deletions

View File

@@ -2,12 +2,14 @@
declare(strict_types=1);
require_once "var_loading.inc.php";
ini_set('session.use_only_cookies' , 1);
ini_set('session.use_strict_mode' , 1);
session_set_cookie_params([
'lifetime' => 1800,
'domain' => 'ethernal.win',
'domain' => $_ENV["COOKIES_SITE"],
'path' => '/',
'secure' => true,
'httponly' => true
@@ -28,4 +30,11 @@ if ( !isset($_SESSION["last_regen"]) ){
function session_regen() {
session_regenerate_id();
$_SESSION["last_regen"] = time();
}
}
# Default language
if (!isset($_SESSION["lang"])) {
$_SESSION["lang"] = "es";
}
$lang = $_SESSION["lang"];

383
includes/lang.inc.php Normal file
View File

@@ -0,0 +1,383 @@
<?php
// This file contains every text line, and translation across languages, search using || for different pages,
// I'm considering doing all of this with a database, but I'm not sure yet.
declare(strict_types=1);
function langChange() {
if (isset($_GET['langchange'])){
($_SESSION["lang"] == "es") ? $_SESSION["lang"] = "en" : $_SESSION["lang"] = "es";
$redirect_url = strtok($_SERVER["REQUEST_URI"], '?');
header("Location: " . $redirect_url);
}
}
# System for changing langauges
langChange();
/* -------------------------------------------- Main -------------------------------------------- */
$tr["en"]["main.chatTitle"] = "chat";
$tr["es"]["main.chatTitle"] = "chat";
$tr["en"]["main.servicesTitle"] = "services";
$tr["es"]["main.servicesTitle"] = "servicios";
$tr["en"]["main.articlesTitle"] = "articles";
$tr["es"]["main.articlesTitle"] = "artículos";
$tr["en"]["main.updatesTitle"] = "updates!";
$tr["es"]["main.updatesTitle"] = "actualizaciones!";
$tr["en"]["main.invitationDisclaimer"] = "Some may require an account! Invitation only.";
$tr["es"]["main.invitationDisclaimer"] = "Algunos requieren una cuenta, sólo por invitación!";
$tr["en"]["main.services_Masivana"] = "masivana";
$tr["es"]["main.services_Masivana"] = "masivana";
$tr["en"]["main.servicesMovies"] = "Movies";
$tr["es"]["main.servicesMovies"] = "Peliculas";
$tr["en"]["main.servicesRequests"] = "Request";
$tr["es"]["main.servicesRequests"] = "Peticiones";
$tr["en"]["main.servicesBooks"] = "Books";
$tr["es"]["main.servicesBooks"] = "Libros";
$tr["en"]["main.servicesVideos"] = "Videos";
$tr["es"]["main.servicesVideos"] = "Videos";
$tr["en"]["main.services_Clouds"] = "cloud(s)";
$tr["es"]["main.services_Clouds"] = "nube(s)";
$tr["en"]["main.servicesCloud"] = "Cloud";
$tr["es"]["main.servicesCloud"] = "Nube";
$tr["en"]["main.servicesPhotos"] = "Photos";
$tr["es"]["main.servicesPhotos"] = "Fotos";
$tr["en"]["main.services_Misc"] = "misc.";
$tr["es"]["main.services_Misc"] = "demás";
$tr["en"]["main.servicesFileConverter"] = "File Converter";
$tr["es"]["main.servicesFileConverter"] = "Conversor";
$tr["en"]["main.servicesPdfTool"] = "Pdf. Tools";
$tr["es"]["main.servicesPdfTool"] = "Herr. pdfs";
$tr["en"]["main.servicesVidDown"] = "Vid. Downloader";
$tr["es"]["main.servicesVidDown"] = "Desc. Videos";
$tr["en"]["main.servicesChatStats"] = "Chat Stats";
$tr["es"]["main.servicesChatStats"] = "Estad. Chats";
$tr["en"]["main.servicesWhiteboard"] = "Whiteboard";
$tr["es"]["main.servicesWhiteboard"] = "Pizarra";
$tr["en"]["main.servicesGamePanel"] = "Game panel";
$tr["es"]["main.servicesGamePanel"] = "Pan. Juegos";
$tr["en"]["main.updatesOneTitle"] = "New website!";
$tr["es"]["main.updatesOneTitle"] = "Nuevo sitio web!";
$tr["en"]["main.updatesOne"] = "New website! I hope you find these new changes favorable, it's been a while since I wanted to make my own website from scratch, I spent some hours re-learning html css. I honestly prefer a bloat-less internet, therefore there won't be any javascript (unless specified)";
$tr["es"]["main.updatesOne"] = "Nuevo sitio web! Espero les guste, desde ya hacía tiempo que quería tener mi propio sitio web, pero programado desde cero, estuve unas horitas re-aprendiendo html y css, sinceramente prefiero un internet sin bloat, por lo que a-priori no habrá javascript en este sitio. ";
$tr["en"]["main.updatesOneDate"] = "17 Jan 2026";
$tr["es"]["main.updatesOneDate"] = "17 Ene 2026";
$tr["en"]["main.updatesTwoTitle"] = "Website redesign!";
$tr["es"]["main.updatesTwoTitle"] = "Rediseño del sitio!";
$tr["en"]["main.updatesTwo"] = "I decided to give this website a whole new appeareance, the previous design was pretty barebones so I hope y'all like it! (Mobile optimized :D) If you wanna know more:";
$tr["es"]["main.updatesTwo"] = "Después de un tiempo decidí darle una nueva cara al sitio ya que el diseño anterior dejaba bastante que desear, espero que sea de su agrado!(Optimizado para todo tipo de dispositivos) Para más información ";
$tr["en"]["main.updatesTwo.1"] = "Website Redesign";
$tr["es"]["main.updatesTwo.1"] = "Rediseño de la página";
$tr["en"]["main.updatesTwo.2"] = "Archived version";
$tr["es"]["main.updatesTwo.2"] = "Versión archivada";
$tr["en"]["main.updatesTwoDate"] = "2 Feb 2026";
$tr["es"]["main.updatesTwoDate"] = "2 Feb 2026";
$tr["en"]["main.updatesThreeTitle"] = "Under the hood changes";
$tr["es"]["main.updatesThreeTitle"] = "Cambios técnicos";
$tr["en"]["main.updatesThree"] = "After some trial and error, I set-up this site using a selfhosted git server, implementing and pushing some changes I'm working on like php code to improve website structure and maintenance, you can test the chat right now, or you can visit";
$tr["es"]["main.updatesThree"] = "Estuve probando, y tras configurar lo necesario, configuré mi propio servidor git, y de allí un workflow para que se publique automaticamente, también estoy empezando a implementar php, por el momento solo estoy probando pero se puede testear en el chat, o viendo el código fuente en ";
$tr["en"]["main.updatesThree.1"] = "https://git.ethernal.win/masiv/website";
$tr["es"]["main.updatesThree.1"] = "https://git.ethernal.win/masiv/website";
$tr["en"]["main.updatesThree.2"] = " to see the source code.";
$tr["es"]["main.updatesThree.2"] = "";
$tr["en"]["main.updatesThree.3"] = "This is my first time using git, php, and more, don't expect best practices on the first try, rest assured I will keep improving :p";
$tr["es"]["main.updatesThree.3"] = "Es mi primera vez usando git, php, y todo, así que probablemente no esté siguiendo todas las buenas prácticas, pero iré aprendiendo :p";
$tr["en"]["main.updatesThreeDate"] = "4 Feb 2026";
$tr["es"]["main.updatesThreeDate"] = "4 Feb 2026";
$tr["en"]["main.articlesOne"] = "About this hosting";
$tr["es"]["main.articlesOne"] = "Acerca del host";
$tr["en"]["main.articlesTwo"] = "DIY Calculator";
$tr["es"]["main.articlesTwo"] = "Calculadora DIY";
$tr["en"]["main.articlesThree"] = "Website redesign";
$tr["es"]["main.articlesThree"] = "Rediseño de la página";
$tr["en"]["main.articlesFour"] = "CSS Shenaningans";
$tr["es"]["main.articlesFour"] = "Cositas del CSS";
$tr["en"]["main.chatLoginText"] = "Login";
$tr["es"]["main.chatLoginText"] = "Ingreso";
$tr["en"]["main.chatRegisterText"] = "Register";
$tr["es"]["main.chatRegisterText"] = "Registro";
$tr["en"]["main.chatUserPlaceholder"] = "User";
$tr["es"]["main.chatUserPlaceholder"] = "Usuarix";
$tr["en"]["main.chatPasswordPlaceholder"] = "Password";
$tr["es"]["main.chatPasswordPlaceholder"] = "Contraseña";
$tr["en"]["main.chatSendPlaceholder"] = "Press enter to send!";
$tr["es"]["main.chatSendPlaceholder"] = "Enter para enviar!";
$tr["en"]["main.about"] = "About me";
$tr["es"]["main.about"] = "Sobre mí";
$tr["en"]["main.lang"] = "Español";
$tr["es"]["main.lang"] = "English";
$tr["en"]["main.verticalScroll"] = "hello earthlings, this message if for you all that are wondering whether extra-terrestial life exists or you humans are alone. I guess you will never know... ";
$tr["es"]["main.verticalScroll"] = "hola terrícolas, esta transmisión es para todxs aquellxs que se preguntan si acaso existe la vida extraterrestre, o en caso contrario ustedes humanos están solxs. Supongo nunca lo sabrán... ";
$tr["en"]["main.altWebring"] = "the top of a fuzzy, black sphere with two arrows rising from it, one curving to the left, one to the right. across the bulk of the sphere it reads NO AI / WEBRING in squiggly, uneven letters and next to those words is a small question mark";
$tr["es"]["main.altWebring"] = "la ciima de una difusa bola negra con dos flechas saliendo de la missma, una hacia la derecha y la otra hacia la izquierda. Se puede leer en el cuerpo de la esfera NO AI / WEBRING con letras medio temblorosas, y al lado un signo de interrogación";
$tr["en"]["main.try_hoveringPath"] = "img/decorations/try_hovering_en.png";
$tr["es"]["main.try_hoveringPath"] = "img/decorations/try_hovering_es.png";
$tr["en"]["main.try_hoveringAlt"] = "try hovering!";
$tr["es"]["main.try_hoveringAlt"] = "apoya el cursor!";
$tr["en"]["main.try_tappingPath"] = "img/decorations/try_tapping_en.png";
$tr["es"]["main.try_tappingPath"] = "img/decorations/try_tapping_es.png";
$tr["en"]["main.try_tappingAlt"] = "try tapping!";
$tr["es"]["main.try_tappingAlt"] = "mantén presionado!";
$tr["en"]["main.try_SlidingPath"] = "img/decorations/try_sliding_down_en.png";
$tr["es"]["main.try_SlidingPath"] = "img/decorations/try_sliding_down_es.png";
$tr["en"]["main.try_SlidingAlt"] = "try sliding down!";
$tr["es"]["main.try_SlidingAlt"] = "prueba seguir deslizando!";
/* -------------------------------------------- Navbar -------------------------------------------- */
$tr["en"]["navbar.about"] = "About me!";
$tr["es"]["navbar.about"] = "Sobre mí!";
$tr["en"]["navbar.langPicker"] = "Español";
$tr["es"]["navbar.langPicker"] = "English";
/* -------------------------------------------- About -------------------------------------------- */
$tr["en"]["about.construction"] = "Still under construction, come back later!";
$tr["es"]["about.construction"] = "Todavía en construcción, vuelve más tarde!";
/* -------------------------------------------- Calc -------------------------------------------- */
$tr["en"]["calc.title"] = "Calculator";
$tr["es"]["calc.title"] = "Calculadora";
$tr["en"]["calc.h1"] = "About this project";
$tr["es"]["calc.h1"] = "Sobre este projecto";
$tr["en"]["calc.p1"] = "It has certainly been a while since I've touched Javascript,
and I wanted to regain some of the know-how I had about it,
that's why decided to code this calculator from scratch
without using any external libraries, nor chatbots, only
wikis like w3 school about the language itself even if
that required more time.";
$tr["es"]["calc.p1"] = "Hace tiempo que no programaba en Javascript, y quería
nuevamente agarrarle la mano, por lo que decidí hacer esta
calculadora sin hacer uso de absolutamente nada más que
w3 school y algunas búsquedas sobre javascript, nada de
preguntar mis dudas a ninguna IA (aunque sea más lento).";
$tr["en"]["calc.p2"] = "So it began my learning journey, coding this entire calculator
has been quite a joy I must say, and even if the final product
is lacking some funcionality like parenthesis parsing it still
works completely fine for most things, as it process inputs using
PEMDAS.";
$tr["es"]["calc.p2"] = "Así que me puse manos a la obra re-aprendiendo algunas cosas,
he de decir que fue un ejercicio divertido, y aunque el
resultado carece de algunas características (cómo el uso
de paréntesis), sigue el orden de las operaciones, y eso
es bastante.";
$tr["en"]["calc.p3"] = "Were I to make it all over again, I would probably go about
things differently, researching about more efficient algorithms
and methods and not reinventing the wheel, but the thing is,
that's the entire point of this excersice, wasn't for that
self-impossed limitation, I could make use of tons of more
efficient libraries.";
$tr["es"]["calc.p3"] = "En un futuro si la hiciese nuevamente, podría implementar
algoritmos más eficientes, puesto que realmente lo hice de
la manera que se me fue ocurriendo, y realmente debe ser muy
ineficiente, si quisiese eficiencia tendría mil maneras y
librerías, pero el objetivo de este ejercicio es aprender.";
$tr["en"]["calc.p4"] = "Now about the inner workings of the script, I implemented a
simple array that stores every character typed, and once the
equal key is pressed, it sends the array to be processed in
the following steps:";
$tr["es"]["calc.p4"] = "Yendo un poco más a lo técnico, mi idea principal fue almacenar
cada caracter escrito en un array, y luego procesarlo de la
siguiente manera:";
$tr["en"]["calc.p4l1"] = "Concatenate the digits, from [1,1,'+',2,3] to [11,'+',23].";
$tr["es"]["calc.p4l1"] = "Unir los números, de [1,1,'+',2,3] a [11,'+',23]";
$tr["en"]["calc.p4l2"] = "Search for term separators, and create multidimensional arrays with
each level representing one type of operation.";
$tr["es"]["calc.p4l2"] = "Buscar dónde están los separa términos, e ir creando arrays
multidimensionales, cada nivel tiene un tipo de operación (on orden).";
$tr["en"]["calc.p4l3"] = "Undo all this array but backwards, processing the output as it goes.";
$tr["es"]["calc.p4l3"] = "Deshacer ese array multidimensional, e ir procesando
todas las operaciones.";
$tr["en"]["calc.p5"] = "It looks easy on paper, but I spent an entire day and a half coding and dealing with
each aspect of programming, things I didn't quite remember, others I didn't know from
the get-go, etc. (I must add a personal rant about how difficult is dealing with
multidimensional arrays, it's not a trivial task for sure).";
$tr["es"]["calc.p5"] = "Dicho así parece sencillo, pero esutve un día y medio programando y lidiando
con cosas que, o no sabía, o no recordaba. (He de decir que trabajar con tanta iteración
en los arrays multidimensionales es un trabajo no trivial).";
$tr["en"]["calc.p6"] = "Update 23/01/2026 ";
$tr["es"]["calc.p6"] = "Actualización 23/01/2026 ";
$tr["en"]["calc.p7"] = "I showed my calculator to a friend of mine and they
pointed out I was lacking a 0 button, how could I miss
that, seriously XD.";
$tr["es"]["calc.p7"] = "Le mostré la calcualdora a unx amigx, y me hizo darme
cuenta de que no había implementado el botón del 0,
la verdad no tengo ni idea cómo no me di cuenta XD.";
/* -------------------------------------------- About host -------------------------------------------- */
$tr["en"]["about-host.title"] = "About this hosting";
$tr["es"]["about-host.title"] = "Acerca de este hosting";
$tr["en"]["about-host.content"] = "
<p>
Hello, <br><br>
You clicking this article means you have an interest on how this
website is structured, and what infrastructure it runs in.
I've gotta say this will probably change over time, but there is one
aspect I will adhere to, mantaining custody over my own data, in practice
that means everything I host will be hosted on-site on my own infrastructure,
just below a little about the <i>homelab's</i> history and some details.<br>
</p>
<h3>Specs</h3>
<div class='specs panel'>
<p>
CPU: AMD Ryzen 5 4600G <br>
RAM: 32GB DDR4 3200MHZ <br>
Motherboard: ASRock A320M-HDV 4.0 <br>
PSU: EVGA 450W 80plus <br>
Storage: <br>
<ul>x1 1TB SSD NVME Samsung 970 Plus</ul>
<ul>x2 3TB HDD WD Green (RAID 1)</ul>
Case: No-name brand,
quite square-ish.<br>
</p>
</div>
<h3>History</h3>
<p>
Each one of the components has a different origin, the case, psu and motherboard
have always been the same since the begining, part of the original PC I got as
a birthday present a while back, it was equiped with 8gb of ram, a modest HDD,
together with an AMD Ryzen 3 3200G, it was enough back then, but just as it came,
I got myself a brand new laptop, somewhat comparable (or even better) to the pc,
I ended up using it way more, thanks to it being portable.
</p>
<p>
After some time, can't quite remember the reason, I took the decision to move it to its
current location, a secure place with a good broadband connection, this was all the way
back at the start of 2022, when I installed Ubuntu Server 22.04 LTS.
</p>
<p>
I graudually updated it, I got the current proccesor over on amazon, then the ram
(attempted to purchase it from Aliexpress, but once it arrived I discovered it
wasn't compatible, had to re-sell it, and buy my current 2x16gb kit), and last but
not least, two 3tb disks which I thought was plenty for my usecase (foreshadowing).
</p>
<p>
I currently still have the same Ubuntu Server install on bare hardware, and almost
every single service I host is using a docker container, managed using Portainer.
</p>
<h3>Networking</h3>
<h4>Domain name</h4>
<p>
I've used several domain names over time, starting with No-IP to ssh remotely, rapidely migrating
to DuckDNS, that setup endured quite a while but after having some problems with DNS resolution, and
limitations on their DNS capabilities (they used AWS) thanks to my sub-domain repertoire I
decided to finally make the leap and purchase my own domain on some of the internet's registrars,
ended up with this domain on Porkbun, for a measly 5 dollars and a half, a lot /s.
</p>
<h4>Proxy &amp; DDNS</h4>
<p>
I use NginxProxyManager to manage all my domains and redirects, I don't plan on migrating to
Traefik for now because NPM does the job, and increasing my infrastructure's complexity isn't my
number one priority, maybe in the future. For Dynamic DNS I use DDClient, my ISP (Antel) doesn't
provide static IPs to residential addresses, so I'm stuck having to update my registers once or
twice a day in-leiu of having a fixed one.
</p>";
$tr["es"]["about-host.content"] = "
<p>
Buenas, <br><br>
Si estás leyendo esto es que te interesa saber un poco sobre la estructura
en la que están hosteados mis servicios, y esta página.
He de decir que esto irá cambiando, pero si hay algo que no creo cambie
será el hecho de que quiero mantener la custodia de mis datos, por lo que
todos lo que hostee será hosteado en mi propio <i>homelab</i>, debajo detalles e historia.<br>
</p>
<h3>Especificaciones</h3>
<div class='specs panel'>
<p>
Procesador: AMD Ryzen 5 4600G <br>
RAM: 32GB DDR4 3200MHZ <br>
Placa: ASRock A320M-HDV 4.0 <br>
PSU: EVGA 450W 80plus <br>
Almacenamiento: <br>
<ul>x1 1TB SSD NVME Samsung 970 Plus</ul>
<ul>x2 3TB HDD WD Green (RAID 1)</ul>
Gabinete: Marca genérica, <br>
es bastante cuadrado.
</p>
</div>
<h3>Historia</h3>
<p>
Cada componente tiene una historia un poquito diferente, el gabinete,
fuente y placa madre han sido la misma, y fueron un regalo de cumpleaños
de hace tiempo, en su momento con 8gb de ram, un disco HDD modesto, y
un AMD Ryzen 3 3200G, en su momento era algo, mas justo coincidió que
en esa ocasión, había recibido una laptop, a la cual le terminé dando
muchísimo más uso que a la torre, sumado al hecho de poderla transportarla
que personalmente me fue un gran plus.
</p>
<p>
Tiempo después, ya no recuerdo bien en qué contexto, decido llevarla al
lugar dónde ahora se encuentra, dónde estaba segura y con una buena conexión
de fibra óptica, esto fue por 2022, cuándo le instalé Ubuntu Server 22.04 LTS.
</p>
<p>
Gradualmente la fui mejorando, le compré su procesador actual por internet, luego
la memoria ram (intenté comprarla por Aliexpress, pero resultaba era incompatible,
por lo que tuve que revenderla, y comprarme los dos sticks de 16gb que tengo ahora),
y por último la decisión de comprar dos discos de 3tb para tener almacenamiento de
sobra (que resulta no lo fue) para lo que quisiese.
</p>
<p>
Actualmente sigo teniendo instalado el Ubuntu directo sobre el hardware, y casi todo
lo que tengo instalado allí lo manejo usando Docker a través de Portainer.
</p>
<h3>Red</h3>
<h4>Dominio</h4>
<p>
He usado varios dominios, al principio llegué a usar No-IP para conectarme remotamente,
para luego rápidamente migrar a DuckDNS, que me supo proveer de dominios gratuitos por varios años,
sin embargo, luego de toparme con las limitaciones de su servicio (por la cantidad de sub-dominios,
y debido a su dependendencia en servidores de no tan buena calidad de AWS) decidí invertir y
comprarme el dominio que estoy usando actualmente, con el registrante de Porkbun, que
debo decir fue muy económico, actualmente pago unos 5 dólares y medios al año, básicamente nada.
</p>
<h4>Proxy y DDNS</h4>
<p>
Para manejar los dominios y redirecciones he usado y seguiré usando NginxProxyManager, por ahora
no tengo planeado migrar a Traefik puesto que no está dentro de mis prioridades añadir
esa complejidad a mi setup (aunque quizás en un futuro lo haga). Uso DDClient para el DNS dinámico
puesto que mi ISP (Antel) no provee IP fijas a planes residenciales, y necesito actualizar los
registros con mi IP cada vez que esta cambia.
</p>";