I would like to ask for your help about localizing my apps.
I need to translate some js files. For this I use jQuery.i18n.
My problem is that I could load my external resource file.
How can I correctly specify my path to one of my resource json files ?
And I try to load my specific resource string
I tried to used ~/Scripts... also ./Scripts...
but I could not load this json file.
Thanks
Krpo
I think you're looking for a relative file path. If you provide the layout of your file structure I can help further, but basically...
Go back one folder:
../Scripts/app/Localization/Resources/i18n/sk.json
Go back two folders:
../../Scripts/app/Localization/Resources/i18n/sk.json
Go back three folers:
../../../Scripts/app/Localization/Resources/i18n/sk.json
Etc...
Related
I have this scenario to reproduce an HTML implementation for 100+ images of different names.
myPackageDirectory
- index.html
- some_name.png
- script/css files
Currently, I have to manually do the following
pick each image file from pool,
place it into the
packageDirectory, then
rename it to static img.png, then
package(zip) the iteration.
I wish to skip renaming part from xyz.png --> img.png by something like <img src="*.png" /> kind of thing.
"Client-side method"
I've used python to automate iterations, but am looking for some html/js way to pick file just by extension
It seems you want to obtain a list of file names on the server with the .png extension.
If your server allows directory listing, you can do this with client side JavaScript. Otherwise, you'll need a server side solution.
See the answers here: Easiest way to get list of files in the server directory
I am creating browser based video editing tool. I want a user to first download a ~70mb javascript file and store it somewhere on his computer. I want to link that file when my website is opened. How can I achieve that.
EDIT
What i meant is that there are various files like js1.js,js2.js... all sums upto 70mb . So i will offer a zip folder to download and only link js1 or js2 file etc depending on the effects user wish to apply
i am sorry to inform you but i think there is something really wrong with what you are trying to do.
A "solution" would be to just cache the javascript on the user's browser so any subsequent requests parse the cache instead of requesting the resource again from the server.
You should know however that if you are in need to download ~70mb of a javascript file you are doing something wrong. I have a whole web app project that when published the total size is around 60mb, all files required to properly run included, and its a damn big codebase in there.
I find it very hard to believe there is ever a need for a single javascript file to be that big, in any case maybe a simple caching should do the trick
That is actually done automatically. Once you add a <script> tag with a link to a local js file (also stored on the server) the file is loaded automatically.
See HTML <script> src Attribute for more information on that.
You can only reference to js files on the server. Files on the server could look like this:
index.html
somefancyjsfile.js
You can then reference from inside your html file to the js file via the <script> tag.
I'm not sure though if the size is not a bit too much...
I have a lot of .asciidoc files (~50). Basically, I want to create a website that can show the content of all these files on the webpage.
Till now, everything that I found basically converts the .asciidoc file into an individual .html file. This means I'll have ~50 .html files which I don't really want to do.
Is there anyway so that I can have a single webpage and somehow insert the contents of the .asciidoc file in the backend? Like PHP?
Sure, this can be done, but not by asciidoctor itself. Take a look at the OpenDevise landing page. You can see they're loading the files through the Asciidoctor API. You could do the same thing with shelling out or using the JavaScript port (asciidoctorjs). The main idea is to have something else generating a scaffold or template and then calling out to asciidoctor somehow to get the content.
In my ASP.Net project, I have implemented URL Routing. So even if my page is in the root directory, I am accessing it using URL routing as given below:
My actual Page is projectpage.aspx, which is in the root directory. I have registered its route as project/{projectname}/{cityname}/{projectid}.
There is another javascript which is included in this page. In this javascript, there is a code to access images in "resources" folder which is done by simply resources/{imagename}, but when I do View Source of the page, the path is shown like project/{projectname}/{cityname}/{projectid}/resources/{imagename}. But the "resources" folder is also in the root folder.
I also tried using "~/" before resources folder, but same thing happens.
Please let me know in case anyone has a solution to this problem.
Thanks & Regards,
Munjal
it think you should try /resources/{imagename}
here's the thing:
i built my site with SEO friendly urls...but i have problem now calling ajax files becaus eth epath is wrong and I cant set an absolute url when i call my files in background..
for instance my page is here (similar to StackOverflow..)
www.domain.com/product/123/this-is-a-product
but my javascripts functions, in folder /js,now they try to reach the files but they cant obvisouly because are set to relative path...
how can i solve this issue??
EDIT: Found this How to get the root path in JavaScript?
When you are using freindly urls, then you have to use path started with /. But then you are starting path from main path.