Skip to content

Commit cbb4a8f

Browse files
committed
Fix #6 i18n - UI in english, some error in english
1 parent 70d4e68 commit cbb4a8f

File tree

15 files changed

+450
-60
lines changed

15 files changed

+450
-60
lines changed

package-lock.json

Lines changed: 196 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"express": "^4.19.2",
5151
"http-errors": "^2.0.0",
5252
"http-status-codes": "^2.3.0",
53+
"i18n": "^0.15.1",
5354
"node-dependency-injection": "^3.1.2",
5455
"superagent": "^9.0.2",
5556
"tinyurl": "^1.1.7",
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {ReasonPhrases, StatusCodes} from "http-status-codes";
2+
import {isSet} from "node:util/types";
3+
import i18n from "i18n";
4+
5+
export default class ServiceUnavailableException {
6+
constructor(message = null) {
7+
this.code = ReasonPhrases.SERVICE_UNAVAILABLE;
8+
this.status = StatusCodes.SERVICE_UNAVAILABLE;
9+
this.message = isSet(message) ? message : i18n.__('server.error.unavailable');
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {ReasonPhrases, StatusCodes} from "http-status-codes";
2+
import {isSet} from "node:util/types";
3+
import i18n from "i18n";
4+
5+
export default class TooManyRequestsException {
6+
constructor(message = null) {
7+
this.code = ReasonPhrases.TOO_MANY_REQUESTS;
8+
this.status = StatusCodes.TOO_MANY_REQUESTS;
9+
this.message = isSet(message) ? message : i18n.__('server.error.tooManyRequests');
10+
}
11+
}

src/locales/en.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"index.title": "BotEnSky Node.js BlueSky Bot hosted on Render.com",
3+
"index.menu.home": "Home - Logs",
4+
"index.menu.principles": "Principles",
5+
"index.menu.faq": "FAQ",
6+
"index.menu.github": "Source Code on GitHub",
7+
"home.bot_activities": "Bot activities",
8+
"home.welcome_on_bot_page": "Welcome on website of ",
9+
"home.a_bluesky_bot": "a BlueSky’s bot",
10+
"home.version": "version",
11+
"home.activities": "Recent activities",
12+
"home.freshness": "freshness",
13+
"home.seven_days_analytics": "7 days analytics",
14+
"home.posts": "posts",
15+
"home.examples": "examples",
16+
"home.best_score": "Best score",
17+
"home.best_likes": "Best likes",
18+
"principles.besplantnet.head": "the robot answers to certain posts!",
19+
"principles.besplantnet.body": "At certain times of the day, the robot searches for images of flowers/plants.\n\n Then it tries to identify the plant, and if successful, it answers the author of the post with an example image.",
20+
"principles.besaskplantnet.head": "the robot answers to certain mentions!",
21+
"principles.besaskplantnet.body": "For the moment it is possible to ask the robot to identify a flower/plant.\n\n To do this, answer a post containing an image of a flower/plant with the mention <code>@botensky.bsky.social</code>.<br/>\n Then you must wait for the robot to wake up for the <b>AskPlantnet</b> plugin (see FAQ)",
22+
"principles.bot_principles": "Bot’s principles",
23+
"principles.functions": "Functions",
24+
"project.line1": "BotEnSky is an open-source project that tries to identify plants or flowers (click on the black GitHub corner).",
25+
"project.line2": "It's a young bot, but it learns from its mistakes.",
26+
"project.line2link": "See the project's tickets",
27+
"project.line3": "The project is open to tinkerers who want to improve the bot.",
28+
"project.line4": "A web designer could bring a lot for example...",
29+
"project.line5": "If someone is working on it, then it is possible that the bot posts more often or strangely.",
30+
"project.line6": "You want to talk about the bot and its features somewhere other than BlueSky, open a discussion.",
31+
"project.line6link": "See the project's discussions",
32+
"faq.title": "Frequently Asked Questions",
33+
"faq.head1": "On this website, it takes a long time to display",
34+
"faq.tag1": "😴",
35+
"faq.body1": "I fall asleep when I'm not stimulated, this is free hosting that optimizes server times.",
36+
"faq.body1b": "yes, also think about saving the planet 🌍",
37+
"faq.body1c": "It takes a little time (sometimes up to 6 minutes) to wake up the server, but then it responds normally.",
38+
"faq.head2": "What time do you wake up?",
39+
"faq.tag2": "🕐",
40+
"faq.body2": "For the moment it's not too fixed yet. apart from manual shots,",
41+
"faq.body2a": "For the plugin <b>PlantNet</b> : I simulate at ~ 17:15/17:25, and practice at 17:30, 19:30 (FR).",
42+
"faq.body2b": "For the plugin <b>AskPlantnet</b> (in testing phase): I practice at 12:00 and 17:00 (FR).",
43+
"server.error.unexpected": "Unexpected error",
44+
"server.error.unavailable": "I am currently under maintenance, please try again later",
45+
"server.error.tooManyRequests": "Request too close together, please try again later",
46+
"server.pleaseReportIssue": "please look for or report it on ",
47+
"server.issueLinkLabel": "issues"
48+
}

0 commit comments

Comments
 (0)