Localization changes

This commit is contained in:
Dendy 2023-01-10 15:54:42 +01:00
parent f9d3370574
commit 599da85947
5 changed files with 162 additions and 42 deletions

View File

@ -17,10 +17,50 @@ contact = "Contacte"
programming = "Programació"
git = "Perfil git"
keys = "Claus"
# main page
welcome = "Text per ocupar el espai"
welcomeHeader = "Yepa!"
welcome = "
<p>Hola i benvingudi a la meua pàgina</p>
<p>
Ací allotje les coses que fet així com
les que estic fent actualment, opinions
candents, coses que crec que mereixen ser
compartides i coses que me representen com
persona.
</p>
<p>
Si vols saber més de mí pots vore-ho
ací o pots contactar-me.
</p>
<p>
Espere que trobes coses que siguen del teu interés.
</p>
"
projectsHeader = "Projects"
projects = "
<h3>fai.st</h3>
<p>
Allotje i administre una sèrie de serveis de programari
lliure (un servidor fediversal, una instancia de Gitea, servei
VPN...) amb el nomb de <b>fai.st</b> amb uns amics.
</p>
<h3>USG</h3>
<p>
Clon competitiu del Tetris que busca ser correcte. Realitzat en
el llenguatge zig y amb la llibreria de SDL i renderització OpenGL.
Majoritariament fet el propòsit de aprendre.
</p>
<h3>keno</h3>
<p>
Client i biblioteca per a consumir la API de Mastodon gastant GTK i C.
Actualmen no està en desevolupament actiu.
</p>
"
# footer
copyright = "Aquesta pàgina està baix la llicència GPLv3 i el seu codi font estarà diponible prompte™. Els recursos utilitzats en aquesta pàgina estan baix CC-SA si no se especifica lo contrari."
copyright = "Aquesta pàgina està baix la llicència GPLv3 i el seu codi font estarà diponible prompte™. Els recursos utilitzats en aquesta pàgina estan baix CC-BY-NC-SA si no se especifica lo contrari."

View File

@ -16,10 +16,49 @@ contact = "Contact"
programming = "Programming"
git = "Git profile"
keys = "Keys"
# main page
welcome = "Text to occupy space"
welcomeHeader = "Hi"
welcome = "
<p>Hello and welcome to my place!</p>
<p>
Here I'm hosting the things I've done,
thing's im currently doing, my hot takes
and things that I think are worth sharing
and represent who I am as a being
</p>
<p>
If you want to know more about me you
can see it here or contact me.
</p>
<p>
Hope you find something that interests you.
</p>
"
projectsHeader = "Projects"
projects = "
<h3>fai.st</h3>
<p>
I host and manage a number of free software services
(a fediverse server, Gitea instance, VPN...)
under the name <b>fai.st</b> alongside some friends.
</p>
<h3>USG</h3>
<p>
Proper competitive tetris clone made in ziglang and SDL2,
with OpenGL rendering. Mostly made for learning purposes.
</p>
<h3>keno</h3>
<p>
Mastodon-API client and library using C and GTK. Not under
active development anymore.
</p>
"
# footer
copyright = "This website is under the GPLv3 license and its source code will be avalible soon™. The resources used on this website are under CC-SA unless stated otherwise."
copyright = "This website is under the GPLv3 license and its source code will be avalible soon™. The resources used on this website are under CC-BY-NC-SA unless stated otherwise."

View File

@ -17,10 +17,49 @@ contact = "Contacto"
programming = "Programación"
git = "Perfil git"
keys = "Claves"
# main page
welcome = "Texto para ocupar espacio"
welcomeHeader = "¡Buenas!"
welcome = "
<p>Hola y bienvenide a mi página</p>
<p>
Aquí alojo las cosas que hecho así como
las que estoy actualmente haciendo, opiniones
candentes, cosas que creo que vale la pena
compartir y cosas que me representan como persona.
</p>
<p>
Si quieres saber más sobre mí lo puedes ver
aquí o puedes contactarme.
</p>
<p>
Espero que encuentres cosas que te sean de interés.
</p>
"
projectsHeader = "Projects"
projects = "
<h3>fai.st</h3>
<p>
Alojo y administro una serie de servicios sofware libre
(un servidor fediversal, una instancia de Gitea, servicio VPN...)
bajo el nombre <b>fai.st</b> con unos amigos.
</p>
<h3>USG</h3>
<p>
Clon competitivo del Tetris de implementación correcta realizado
en ziglang y SDL2, con renderización mediante OpenGL. Mayoritariamente
hecho con el propósito de aprender.
</p>
<h3>keno</h3>
<p>
Cliente y biblioteca para consumir la API de Mastodon usando GTK y C.
Actualmente no está en desarrollo activo.
</p>
"
# footer
copyright = "Esta página está bajo la licencia GPLv3 y su código fuente estará diponible pronto™. Los recursos usados en esta página están bajo CC-SA a no ser que se diga lo contrario."
copyright = "Esta página está bajo la licencia GPLv3 y su código fuente estará diponible pronto™. Los recursos usados en esta página están bajo CC-BY-NC-SA a no ser que se diga lo contrario."

View File

@ -22,4 +22,4 @@ keys = "Kweys"
welcome = "Tewxt to occupy spwace >:3c"
# footer
copyright = "Twis website is unwer the GPLv3 wicense and its sowwse code avawwable soon™. De wesources used on this webwsite are under CC-SA unwess stated oderwise. UwU"
copyright = "Twis website is unwer the GPLv3 wicense and its sowwse code avawwable soon™. De wesources used on this webwsite are under CC-BY-NC-SA unwess stated oderwise. UwU"

View File

@ -9,7 +9,9 @@ $lang = null;
// Avaliable detected languages
$langs = [];
// Function that gets the strings
$trans = function(){ return 'N/A'; };
$trans = function () {
return 'N/A';
};
/* I use functions to create scopes. Anything below
* shouldn't be accesible from outside
@ -34,7 +36,7 @@ $__langfunc = function() use (&$lang, &$langs, &$trans){
// To get the langs we scan the folder with the ini files
$langs = scandir($basedir);
// Filter for those that have to letters and end in ".ini"
// Filter for those that have two letters and end in ".ini"
$langs = array_filter($langs, fn ($x) => preg_match('/.*\.ini/', $x) === 1);
// And we remove the ".ini" part
$langs = array_map(fn ($x) => substr($x, 0, 2), $langs);
@ -48,7 +50,7 @@ $__langfunc = function() use (&$lang, &$langs, &$trans){
* format for the header is like this: "en_US,es;q=0.5,ar;q=0.1".
* q=N represents the weight of preference, no q means q=1.0.
*/
{
if ($_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? false) {
// Divide language string per language
$http_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
@ -80,7 +82,6 @@ $__langfunc = function() use (&$lang, &$langs, &$trans){
break;
}
}
}
// Manully selected lang > HTTP lang > fallback lang
@ -93,7 +94,8 @@ $__langfunc = function() use (&$lang, &$langs, &$trans){
$text = parse_ini_file("$basedir/$lang.ini", true);
$trans = function (string $index) use ($text): string {
return htmlspecialchars($text[$index]??"N/A", ENT_QUOTES);
// return htmlspecialchars($text[$index] ?? 'N/A', ENT_QUOTES);
return $text[$index] ?? 'N/A';
};
};