Skip to content

Your favorite shift management application!

chore: add missing sync status messages in translations (#104)

panteL19fe1bb427e4
diff --git a/messages/de.json b/messages/de.json
index fad085b..e539d09 100644
--- a/messages/de.json
+++ b/messages/de.json
@@ -324,7 +324,10 @@
},
"sync": {
"reconnected": "Verbindung wiederhergestellt",
- "disconnected": "Verbindung zum Server verloren"
+ "disconnected": "Verbindung zum Server verloren",
+ "offline": "Keine Internetverbindung",
+ "refreshing": "Daten werden aktualisiert...",
+ "resyncing": "Daten werden synchronisiert..."
},
"onboarding": {
"welcome": "Willkommen bei BetterShift",
diff --git a/messages/en.json b/messages/en.json
index 5c14c6c..e45627d 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -324,7 +324,10 @@
},
"sync": {
"reconnected": "Connection restored",
- "disconnected": "Connection to server lost"
+ "disconnected": "Connection to server lost",
+ "offline": "No internet connection",
+ "refreshing": "Refreshing data...",
+ "resyncing": "Syncing data..."
},
"onboarding": {
"welcome": "Welcome to BetterShift",
diff --git a/messages/it.json b/messages/it.json
index 76b5458..0b24e12 100644
--- a/messages/it.json
+++ b/messages/it.json
@@ -324,7 +324,10 @@
},
"sync": {
"reconnected": "Connessione ripristinata",
- "disconnected": "Connessione al server persa"
+ "disconnected": "Connessione al server persa",
+ "offline": "Nessuna connessione internet",
+ "refreshing": "Aggiornamento dati...",
+ "resyncing": "Sincronizzazione dati..."
},
"onboarding": {
"welcome": "Benvenuto in BetterShift",
diff --git a/scripts/i18n-checks.ts b/scripts/i18n-checks.ts
index f62f6e0..f927976 100644
--- a/scripts/i18n-checks.ts
+++ b/scripts/i18n-checks.ts
@@ -152,6 +152,7 @@ const dynamicPatterns = new Map<string, string>();
* Extract translation key usage patterns from file content
* Matches: t("key"), t('key'), t(`key`)
* Also matches: t("key", ...), t.rich("key"), etc.
+ * Also matches: tRef.current("key") and similar ref patterns
* Handles both static keys and dynamic template patterns
*/
function extractUsedKeys(content: string): Set<string> {
@@ -159,8 +160,10 @@ function extractUsedKeys(content: string): Set<string> {
// Match t("key"), t('key')
// Also handles t.rich(), t.raw(), etc.
+ // Also handles tRef.current("key"), translationRef.current("key"), etc.
const stringPatterns = [
/\bt(?:\.\w+)?\s*\(\s*["']([^"']+)["']/g, // t("key") or t.rich("key")
+ /\w+Ref\.current\s*\(\s*["']([^"']+)["']/g, // tRef.current("key")
];
for (const pattern of stringPatterns) {
@@ -172,26 +175,33 @@ function extractUsedKeys(content: string): Set<string> {
}
// Special handling for template literals: t(`key`) and t(`key${var}`)
+ // Also handles tRef.current(`key`)
// Use 's' flag to match across newlines (dotall mode)
// Match opening backtick, capture everything until closing backtick
- const templatePattern = /\bt(?:\.\w+)?\s*\(\s*`([^`]+)`/gs;
- let templateMatch;
- while ((templateMatch = templatePattern.exec(content)) !== null) {
- // Normalize whitespace in the captured template string
- const fullTemplate = templateMatch[1].replace(/\s+/g, " ").trim();
-
- // Check if it contains ${...} template expressions
- if (isDynamicKey(fullTemplate)) {
- const info = extractDynamicKeyInfo(fullTemplate);
- if (info) {
- // Store the original pattern for later display
- dynamicPatterns.set(info.prefix, fullTemplate);
- // Store the prefix as a marker
- keys.add(`${info.prefix}.*`);
+ const templatePatterns = [
+ /\bt(?:\.\w+)?\s*\(\s*`([^`]+)`/gs, // t(`key`)
+ /\w+Ref\.current\s*\(\s*`([^`]+)`/gs, // tRef.current(`key`)
+ ];
+
+ for (const templatePattern of templatePatterns) {
+ let templateMatch;
+ while ((templateMatch = templatePattern.exec(content)) !== null) {
+ // Normalize whitespace in the captured template string
+ const fullTemplate = templateMatch[1].replace(/\s+/g, " ").trim();
+
+ // Check if it contains ${...} template expressions
+ if (isDynamicKey(fullTemplate)) {
+ const info = extractDynamicKeyInfo(fullTemplate);
+ if (info) {
+ // Store the original pattern for later display
+ dynamicPatterns.set(info.prefix, fullTemplate);
+ // Store the prefix as a marker
+ keys.add(`${info.prefix}.*`);
+ }
+ } else {
+ // Static template literal (no ${})
+ keys.add(fullTemplate);
}
- } else {
- // Static template literal (no ${})
- keys.add(fullTemplate);
}
}