The i18next plugin initialization does not include the implementation of 'resGetPath'

I'm having trouble setting up the resGetPath attribute in i18next to access translation.json files locally. When I initialize the plugin with the resources object, everything works fine. However, when using the resGetPath attribute, I can't seem to get it to work correctly. I suspect there may be an issue with the path or the JSON file structure, but I haven't been able to find a solution on Stack Overflow or other forums for i18next. My goal is to reference the local translation file based on the user's chosen locale. Thank you for your help =).

Here is the code from translation.js that loads successfully into index.html:

$(document).ready(function() {
  i18next.init({
    lng: 'en', 
    resGetPath:'../locales/{{lng}}/translation.json',
  }, function (err, t) {
      jqueryI18next.init(i18next, $, {
        tName: 't',
        i18nName: 'i18n',
        handleName: 'localize',
        selectorAttr: 'data-i18n',
        targetAttr: 'i18n-target',
        optionsAttr: 'i18n-options',
        useOptionsAttr: false,
        parseDefaultValueFromContent: true
      });

      $('#tempTarget').localize();
    })
});

And here is the content of locales/en/translation.json:

{
  "nav": {
    "newInvoice": "somethaaaang"
  }
}

Below is my directory structure:

index.html
locales
   en
      translation.json

This is the line in the HTML that works with the resources object but not with the reGetPath attribute:

<a href="/new-invoice/" data-i18n='nav.newInvoice' id='tempTarget' class="panel-close">New Invoice</a>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What are the best methods to prevent Json/Dict responses from being converted to strings when saving to a dataframe?

Running an API and storing the responses as dictionaries using response.to_dict() to create a new column for future reference. Here is an example dataframe: dict1 = {'thing': 200, 'other thing': 18, 'available_d ...

The JQuery function fails to execute following a successful Ajax request

I recently ran into an issue with my Ajax call. Here's the code snippet in question: $("#start-upload-btn").click(function(){ $.ajax({ type: "post", url: "", data: { newProjectName: $('#project-name') ...

Navigating to an AngularJS state through an email hyperlink

Trying to guide users from an email link to a specific state within my Angular app presents a challenge due to its single page nature, making direct URL redirection impossible. Past attempts involved utilizing URL parameters: The email includes this link ...

What are the ways to convert canvas animations into gif or webm formats?

I've written a function to capture each frame for the GIF, but I'm experiencing laggy output and crashes as the data increases. Any recommendations? function generateGifFromImages(imageList, frameRate, fileName, scaling) { gifshot.createGIF({ ...

Setting up event listeners from a string array (using PIXI.js)

Hey there! I've encountered a bit of an interesting challenge that could easily be resolved by duplicating the code, but where's the fun in that? This project is more of an experiment for me, just to prove that I can do it. However, the idea has ...

Generating views for individual models in a backbone collection

Currently, I am developing a small backbone.js application that simulates a library where CRUD operations can be performed. The core components of this application are the book model and the library collection (which stores books). var Book = Backbone.Mod ...

JQuery Ajax: The loaded content flickers into view, revealing old content momentarily

Having an issue with my ajax code. I am working on a project that involves some links and a content area. The idea is that when a user clicks on a link, the content area should be hidden, load new data, and then show the updated content. However, I have no ...

What causes the circular progress bar to disappear when hovering over the MUI React table?

My goal was to create a table with a CircularProgressBar that changes its background color from orange to dark blue when hovering over the row. However, despite my efforts, I couldn't get it to work as intended. Additionally, I wanted the progressBar ...

The function react__WEBPACK_IMPORTED_MODULE_0___default.a.useContext is not recognized when implementing Autocomplete within Material UI

Every time I attempt to create an Autocomplete tag utilizing Material UI, an error pops up, which can be seen in the following link: https://i.sstatic.net/kxKR4.png The Autocomplete code snippet is as follows: import React, {useState, useEffect, useCo ...

What is the regular expression that allows numbers between 1 and 24, including decimals?

Can anyone help me create a regex expression that only allows numbers between 1 and 24, with up to 2 decimal places? The numbers should range from 1 to 24, as well as include decimals like 1.00, 1.01, 1.02, all the way up to 24.99. ...

Struggle with implementing enums correctly in ngSwitch

Within my application, I have implemented three buttons that each display a different list. To control which list is presented using Angular's ngSwitch, I decided to incorporate enums. However, I encountered an error in the process. The TypeScript co ...

Is it possible to extract JSON data stored in an array by utilizing SwiftyJSON?

I recently started working with JSON data in my iOS app. I used a service to parse the JSON data from a website and now I want to decode it to display to my users in a UITableView. The structure of my JSON data is shown below: { "success": true, "outp ...

Utilize Next.js and GSAP to dynamically showcase images upon hovering over the title

I have a dynamic list of titles that I want to enhance by displaying images when hovering over each title. The issue I'm facing is that when I hover over one title, all the images display at once. As a React beginner, I believe the solution should be ...

Placing a MongoDB query results in an increase of roughly 120MB in the total JS heap size

I'm puzzled by the fact that the heap size increases when I include a MongoDB database query in a function within my controller. Here is the code for my router: import { Router } from "express"; import profileController from '../contro ...

Does Parsley.js offer a way to configure so that the parsley-success field is not added to an input if it should be completely ignored?

Currently, I am excluding one input and adding the success class (which is fine with me) $('form').parsley({ excluded: '[data-parsley-sum-total="all"]' }); However, there are several other inputs without any validations that I do not wa ...

JSONPath encounters an issue when square brackets are embedded within a string

I am encountering issues with the JSONPath library found at https://github.com/JSONPath-Plus/JSONPath in its latest version. For example: { "firstName": "John", "lastName": "doe", "age": 26, ...

Transmit a JSON GSD Command to the Zebra Printer

Looking to communicate with Zebra printers using Python and send commands instead of just labels. According to the documentation on page 574, it shows: https://i.sstatic.net/tDWui.png Below is the code snippet I am using: mysocket = socket.socket(socket. ...

Can you explain the significance of @id and @type within a json-ld context?

Can you explain the meaning of this statement in a JSON-LD context? { "@context": { "@version": 1.1, "id": "@id", "type": "@type" } } Additionally, { "@context" ...

Adding 2-dimensional text to a specified location with the help of three.js

let startPosition = new THREE.Vector3(-5,0,0); let targetPosition = new THREE.Vector3(-5,2,0); let directionVector = new THREE.Vector3().sub(targetPos,startPosition); let arrowHelper = newTHREE.ArrowHelper(directionVector.clone().normalize(),startPosition, ...

Encountered an unforeseen issue: Unexpected character : within jQuery Ajax

After successfully setting up a REST web service in Java that delivers data in "application/json" format, I encountered an issue while attempting to access the REST data from my Windows machine using jQuery $.ajax. The web service is hosted on a separate L ...