mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	server: Initialize backend translations
This commit is contained in:
		
							parent
							
								
									c33154d128
								
							
						
					
					
						commit
						c1010a79f9
					
				
							
								
								
									
										10
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										10
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -1,12 +1,12 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "trilium",
 | 
			
		||||
  "version": "0.90.4",
 | 
			
		||||
  "version": "0.90.6-beta",
 | 
			
		||||
  "lockfileVersion": 3,
 | 
			
		||||
  "requires": true,
 | 
			
		||||
  "packages": {
 | 
			
		||||
    "": {
 | 
			
		||||
      "name": "trilium",
 | 
			
		||||
      "version": "0.90.4",
 | 
			
		||||
      "version": "0.90.6-beta",
 | 
			
		||||
      "license": "AGPL-3.0-only",
 | 
			
		||||
      "dependencies": {
 | 
			
		||||
        "@braintree/sanitize-url": "^7.1.0",
 | 
			
		||||
@ -48,6 +48,7 @@
 | 
			
		||||
        "http-proxy-agent": "7.0.2",
 | 
			
		||||
        "https-proxy-agent": "^7.0.5",
 | 
			
		||||
        "i18next": "^23.14.0",
 | 
			
		||||
        "i18next-fs-backend": "^2.3.2",
 | 
			
		||||
        "i18next-http-backend": "^2.6.1",
 | 
			
		||||
        "image-type": "4.1.0",
 | 
			
		||||
        "ini": "^4.1.3",
 | 
			
		||||
@ -9660,6 +9661,11 @@
 | 
			
		||||
        "@babel/runtime": "^7.23.2"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/i18next-fs-backend": {
 | 
			
		||||
      "version": "2.3.2",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/i18next-fs-backend/-/i18next-fs-backend-2.3.2.tgz",
 | 
			
		||||
      "integrity": "sha512-LIwUlkqDZnUI8lnUxBnEj8K/FrHQTT/Sc+1rvDm9E8YvvY5YxzoEAASNx+W5M9DfD5s77lI5vSAFWeTp26B/3Q=="
 | 
			
		||||
    },
 | 
			
		||||
    "node_modules/i18next-http-backend": {
 | 
			
		||||
      "version": "2.6.1",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-2.6.1.tgz",
 | 
			
		||||
 | 
			
		||||
@ -88,6 +88,7 @@
 | 
			
		||||
    "http-proxy-agent": "7.0.2",
 | 
			
		||||
    "https-proxy-agent": "^7.0.5",
 | 
			
		||||
    "i18next": "^23.14.0",
 | 
			
		||||
    "i18next-fs-backend": "^2.3.2",
 | 
			
		||||
    "i18next-http-backend": "^2.6.1",
 | 
			
		||||
    "image-type": "4.1.0",
 | 
			
		||||
    "ini": "^4.1.3",
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										13
									
								
								src/www.ts
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/www.ts
									
									
									
									
									
								
							@ -12,6 +12,8 @@ import utils from "./services/utils.js";
 | 
			
		||||
import port from "./services/port.js";
 | 
			
		||||
import host from "./services/host.js";
 | 
			
		||||
import semver from "semver";
 | 
			
		||||
import i18next from "i18next";
 | 
			
		||||
import Backend from "i18next-fs-backend";
 | 
			
		||||
 | 
			
		||||
// setup basic error handling even before requiring dependencies, since those can produce errors as well
 | 
			
		||||
 | 
			
		||||
@ -57,6 +59,17 @@ async function startTrilium() {
 | 
			
		||||
        (await import('electron')).app.requestSingleInstanceLock();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Initialize translations
 | 
			
		||||
    i18next.use(Backend).init({
 | 
			
		||||
        lng: "ro",
 | 
			
		||||
        fallbackLng: "en",
 | 
			
		||||
        ns: "server",
 | 
			
		||||
        backend: {
 | 
			
		||||
            loadPath: "translations/{{lng}}/{{ns}}.json"
 | 
			
		||||
        },
 | 
			
		||||
        debug: true
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    log.info(JSON.stringify(appInfo, null, 2));
 | 
			
		||||
 | 
			
		||||
    // for perf. issues it's good to know the rough configuration
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								translations/cn/server.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								translations/cn/server.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
{}
 | 
			
		||||
							
								
								
									
										1
									
								
								translations/en/server.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								translations/en/server.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
{}
 | 
			
		||||
							
								
								
									
										1
									
								
								translations/es/server.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								translations/es/server.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
{}
 | 
			
		||||
							
								
								
									
										1
									
								
								translations/ro/server.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								translations/ro/server.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
{}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user