Skip to content

Commit

Permalink
Merge pull request #4 from biologist79/master
Browse files Browse the repository at this point in the history
Add support for i18next localisation library (biologist79#194)
  • Loading branch information
Joe91 authored Feb 7, 2023
2 parents d97ac88 + 3826e16 commit 33c09ce
Show file tree
Hide file tree
Showing 24 changed files with 1,920 additions and 1,652 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ cmake-build-debug/
platformio-override.ini
src/settings-override.h
src/settings-custom-override.h
node_modules/
1 change: 1 addition & 0 deletions dist/accesspoint.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html><head><title data-i18n="wifi.title"></title><meta charset="utf-8"><script src="/js/i18next.min.js"></script><script src="/js/i18nextHttpBackend.min.js"></script><script src="/js/loc_i18next.min.js"></script><style>input{width:90%;height:44px;border-radius:4px;margin:10px auto;font-size:15px;background:#f1f1f1;border:0;padding:0 15px}body{background:#007bff;font-family:sans-serif;font-size:14px;color:#777}.box{background:#fff;max-width:258px;margin:75px auto;padding:30px;border-radius:5px;text-align:center}.btn{background:#3498db;color:#fff;cursor:pointer;width:90%;height:44px;border-radius:4px;margin:10px auto;font-size:15px}.rebootmsg{display:none}.fas{padding-right:.25em}</style></head><body><form id="settings" action="/init" class="box" method="POST"><h1 data-i18n="wifi.title">WiFi-configuration</h1><label for="ssid" data-i18n="[prepend]wifi.ssid.title">SSID:</label><br><input type="text" id="ssid" name="ssid" placeholder="SSID" required><br><label for="pwd" data-i18n="[prepend]wifi.password.title">Password:</label><br><input type="password" id="pwd" name="pwd" autocomplete="off" required><br><label for="hostname" data-i18n="[prepend]wifi.hostname.title">ESPuino's name (hostname):</label><br><input type="text" id="hostname" name="hostname" placeholder="espuino" required><br><br><button type="submit" id="save-button" data-i18n="submit"></button></form><form action="/restart" class="box"><h1 data-i18n="wifi.restartPrompt">Ready to go?</h1><button type="submit" id="restart-button" data-i18n="restart" value="Reboot"></button></form><script>i18next.use(i18nextHttpBackend).init({backend:{loadPath:"/locales/{{lng}}.json"},debug:!0,fallbackLng:"en"},((e,n)=>{localize=locI18next.init(i18next),localize("body")}));</script></body></html>
Binary file added dist/js/i18next.min.js.gz
Binary file not shown.
Binary file added dist/js/i18nextHttpBackend.min.js.gz
Binary file not shown.
Binary file added dist/js/loc_i18next.min.js.gz
Binary file not shown.
Binary file added dist/locales/de.json.gz
Binary file not shown.
Binary file added dist/locales/en.json.gz
Binary file not shown.
1 change: 1 addition & 0 deletions dist/management.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions gitVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#ifndef __GIT_REVISION_H__
#define __GIT_REVISION_H__
constexpr const char gitRevision[] PROGMEM = "Git-revision: {git_revision}";
constexpr const char gitRevShort[] PROGMEM = "\\"{git_revision}\\"";
#endif
"""

Expand Down
81 changes: 81 additions & 0 deletions html/accesspoint.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<head>
<title data-i18n="wifi.title"></title>
<meta charset="utf-8">
<script src="/js/i18next.min.js"></script>
<script src="/js/i18nextHttpBackend.min.js"></script>
<script src="/js/loc_i18next.min.js"></script>
<style>
input {
width: 90%;
height: 44px;
border-radius: 4px;
margin: 10px auto;
font-size: 15px;
background: #f1f1f1;
border: 0;
padding: 0 15px
}
body {
background: #007bff;
font-family: sans-serif;
font-size: 14px;
color: #777
}
.box {
background: #fff;
max-width: 258px;
margin: 75px auto;
padding: 30px;
border-radius: 5px;
text-align: center
}
.btn {
background: #3498db;
color: #fff;
cursor: pointer;
width: 90%;
height: 44px;
border-radius: 4px;
margin: 10px auto;
font-size: 15px;
}
.rebootmsg {
display: none;
}
.fas{
padding-right: 0.25em;
}
</style>
</head>
<body>
<form id="settings" action="/init" class="box" method="POST">
<h1 data-i18n="wifi.title">WiFi-configuration</h1>
<label for="ssid" data-i18n="[prepend]wifi.ssid.title">SSID:</label><br>
<input type="text" id="ssid" name="ssid" placeholder="SSID" required><br>
<label for="pwd" data-i18n="[prepend]wifi.password.title">Password:</label><br>
<input type="password" id="pwd" name="pwd" autocomplete="off" required><br>
<label for="hostname" data-i18n="[prepend]wifi.hostname.title">ESPuino's name (hostname):</label><br>
<input type="text" id="hostname" name="hostname" placeholder="espuino" required><br><br>
<button type="submit" id="save-button" data-i18n="submit"></button>
</form>
<form action="/restart" class="box">
<h1 data-i18n="wifi.restartPrompt">Ready to go?</h1>
<button type="submit" id="restart-button" data-i18n="restart" value="Reboot"></button>
</form>

<script>
i18next.use(i18nextHttpBackend).init({
backend: {
loadPath: "/locales/{{lng}}.json"
},
debug: true,
fallbackLng: 'en',
}, (err, t) => {
localize = locI18next.init(i18next);
localize('body');
});
</script>
</body>
</html>
62 changes: 0 additions & 62 deletions html/accesspoint_DE.html

This file was deleted.

62 changes: 0 additions & 62 deletions html/accesspoint_EN.html

This file was deleted.

1 change: 1 addition & 0 deletions html/js/i18next.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions html/js/i18nextHttpBackend.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 33c09ce

Please sign in to comment.