Update categoryList socket emissions to include language and translation request: Modified the socket.emit calls in SharedCarousel, Sitemap, and prerender.cjs to support language specification and translation requests. Added JTL language mappings in translate-i18n.js for improved localization.
This commit is contained in:
@@ -68,7 +68,7 @@ const SharedCarousel = () => {
|
|||||||
context && context.socket && context.socket.connected &&
|
context && context.socket && context.socket.connected &&
|
||||||
typeof window !== "undefined"
|
typeof window !== "undefined"
|
||||||
) {
|
) {
|
||||||
context.socket.emit("categoryList", { categoryId: 209 }, (response) => {
|
context.socket.emit("categoryList", { categoryId: 209, language: 'en', requestTranslation: true }, (response) => {
|
||||||
if (response && response.categoryTree) {
|
if (response && response.categoryTree) {
|
||||||
// Store in cache
|
// Store in cache
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ const Sitemap = () => {
|
|||||||
|
|
||||||
// Otherwise, fetch from socket if available (only in browser)
|
// Otherwise, fetch from socket if available (only in browser)
|
||||||
if (context && context.socket && context.socket.connected && typeof window !== "undefined") {
|
if (context && context.socket && context.socket.connected && typeof window !== "undefined") {
|
||||||
context.socket.emit('categoryList', { categoryId: 209 }, (response) => {
|
context.socket.emit('categoryList', { categoryId: 209, language: 'en', requestTranslation: true }, (response) => {
|
||||||
if (response && response.categoryTree) {
|
if (response && response.categoryTree) {
|
||||||
// Store in cache
|
// Store in cache
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -70,6 +70,29 @@ const TARGET_LANGUAGES = {
|
|||||||
'zh': 'Chinese (Simplified)'
|
'zh': 'Chinese (Simplified)'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* JTL mapping
|
||||||
|
bg (Bulgarian) -> kSprache: 37
|
||||||
|
cs (Czech) -> kSprache: 21
|
||||||
|
es (Spanish) -> kSprache: 20
|
||||||
|
fr (French) -> kSprache: 5
|
||||||
|
el (Greek) -> kSprache: 7
|
||||||
|
hr (Croatian) -> kSprache: 11
|
||||||
|
hu (Hungarian) -> kSprache: 24
|
||||||
|
it (Italian) -> kSprache: 10
|
||||||
|
pl (Polish) -> kSprache: 14
|
||||||
|
ro (Romanian) -> kSprache: 26
|
||||||
|
ru (Russian) -> kSprache: 16
|
||||||
|
sk (Slovak) -> kSprache: 18
|
||||||
|
sl (Slovenian) -> kSprache: 19
|
||||||
|
sr (Serbian) -> kSprache: 93
|
||||||
|
sv (Swedish) -> kSprache: 17
|
||||||
|
tr (Turkish) -> kSprache: 22
|
||||||
|
uk (Ukrainian) -> kSprache: 23
|
||||||
|
ar (Arabic) -> kSprache: 30
|
||||||
|
zh (Chinese) -> kSprache: 43
|
||||||
|
*/
|
||||||
|
|
||||||
// Initialize OpenAI client
|
// Initialize OpenAI client
|
||||||
const openai = new OpenAI({
|
const openai = new OpenAI({
|
||||||
apiKey: OPENAI_API_KEY,
|
apiKey: OPENAI_API_KEY,
|
||||||
|
|||||||
Reference in New Issue
Block a user