I'm trying to use i18next for localtization, it works well as it translates english text to arabic {t("title")} ==> مرحبا.
But when i try to change language to english with
const { t, i18n } = useTranslation()
i18n.changeLanguage('en')
it dosen't change.
How to fix this.
I got that error at server vscode terimanl react-i18next:: You will need to pass in an i18next instance by using initReactI18next
I found the solution at nextjs Docs.
It seems changing locales at nextjs not the same as reactjs, with invoking i18n.changeLanguage('en').
But instead use.
<Link href="/fr/another" locale="en">
<a>To /fr/another</a>
</Link>
Will do the job.
more information: https://nextjs.org/docs/advanced-features/i18n-routing
in tx_news template we have <n:link which follow <f:link.typolink seems we can use configuration="{forceAbsoluteUrl: 1}" and get
<h3>
<n:link configuration="{forceAbsoluteUrl: 1}" newsItem="{newsItem}" settings="{settings}" title="{newsItem.title}">
<span itemprop="headline">{newsItem.title}</span>
</n:link>
</h3>
For build absolute link TYPO3 use config.absPrefix but no effect in TYPO3 9.5.3. I can change this settings just in Site Configuration -> Entry Point. But not more in typoscript.
I've checked. This typoscript setting still available in TYPO3 9.5.3. But looks like work just for assets (scripts/styles in header) no more for links? Can i fix that?
In end i need absolute links in tx_news from config.absPrefix or other typoscript but not config.yaml
Try with config.absRefPrefix instead of config.absPrefix
No one solution from typoscript dont work in TYPO3 v9.5.x so I have to use Site manager Variants
rootPageId: 1
base: www.livedomain.com
baseVariants:
-
base: 'http://localhost'
condition: 'applicationContext == "Development"'
-
base: 'https://stagedomain.com'
condition: 'applicationContext == "Testing"'
And in my apache2 or .htaccess
SetEnv TYPO3_CONTEXT Development
or
SetEnv TYPO3_CONTEXT Testing
If context not set website use base url in other cases from baseVariants
I am using the EXPORT-CSV plugin for Highcharts to export data to csv. (Thank you to the developers of this plugin!) When testing in Safari on a Mac, however, the exported csv file does not take the filename as expected from
exporting: {
filename: "FancyFileName"
}
and instead just uses the default Highcharts name "chart". All the built-in export types do use the desired filename from Safari, and the csv also gets the desired filename from all the other standard browsers I have tested.
Here is a fiddle.
How can Safari be convinced to use the filename I give it? Thanks for your help.
The hard coded filename is coming from the php script written on the server. You can find that script on php script for download of file with hardcoded file name
You can use that same code on your local machine server. To do that
create a php file on your local server.
copy the above code in it.
change url www.highcharts.com/studies/csv-export/csv.php in export.csv library to your local server url.
change the name whatever you wish to using $_POST['variablename']
Variable name should be pass when making post call from export.csv library and use in php file using $_POST
Highcharts.post(url, {
data: content,
name: name,
type: MIME,
extension: extension
});
This is the code used in export.csv library for making post call. I have added extra parameter name to be used in my php script for dynamic filename.
I'm attempting to use a JSON object living in a data.json file to be the dataset for a quick prototype I'm working on. This lives in a my_project/www/data/ directory. I have an Angular service that goes and grabs the data within this file using $http, does some stuff to it, and then it's used throughout my app.
I'm using Cordova and Ionic. When using ionic serve on my computer, everything looks perfect in the browser. However, when using ionic view (http://view.ionic.io/) and opening the app on my iPad, I see a:
{"data":null,"status":0,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"../data/items.json","headers":{"Accept":"application/json,test/plain,*/*}},"statusText":""}
for a response. I would think that if it were a relative URL issue, that it would also not work in the browser, but that is not the case.
Here's what I'm doing:
config.xml has this line:
<access origin="*" subdomains="true"/>
My service that preforms the simple request is doing:
return $http.get("../data/data.json").then(function (response) {
return response.data;
});
And finally, in my controller, I ask for the service to preform the request:
myService.goGetData().then(onComplete, onError);
In my browser, onComplete() is invoked and on the iPad, onError() is invoked.
Any guidance?
On your local developer machine you're actually running a webserver when you run ionic serve. So a path like ../../data.json will work because it is totally valid in the context of the webserver that has complete filesystem access.
If, however, you try to do the same thing on your device, you're probably going to run into an issue because the device has security policies in place that don't allow ajax to traverse up outside of the root. It is not a dynamic webserver so it can't load files up the tree. Instead you'd use something like the cordova file plugin to grab the file contents from the filesystem. If you prefer, you can use ngCordova to make interacting with the plugin a bit less painful.
I am 99% sure this is what is happening but you can test my theory by pointing your $http call to some dummy .json data hosted on a publicly available server to see if it works. Here is some dummy json data.
Just gonna leave this here because I had the same problem as the original question author. Simply removing any starting slashes from the json file path in the $http.get function solved this problem for me, now loading the json data works both in the browser emulator and on my android device. The root of the $http call url seems to always be the index.html folder no matter where your controller or service is located. So use a path relative from that folder and it should work. like $http.get("data/data.json")
So this is an example json file. save it as data.json
[
{
"Name" : "Sabba",
"City" : "London",
"Country" : "UK"
},
{
"Name" : "Tom",
"City" : "NY",
"Country" : "USA"
}
]
And this this is what a example controller looks like
var app = angular.module('myApp', ['ionic']);
app.controller('ExhibitionTabCtrl', ['$scope', '$http', function($scope,$http) {
$http.get("your/path/from/index/data.json")
.success(function (response)
{
$scope.names = response;
});
}]);
Then in your template make sure you are you are referencing your controller.
<ion-content class="padding" ng-controller="ExhibitionTabCtrl">
You should then be able to use the a expression to get the data
{{ names }}
Hope this helps :)
I was also looking for this and found this question, since there is no real answer to the problem I kept my search on the Internet and found this answer at the Ionic Forum from ozexpert:
var url = "";
if(ionic.Platform.isAndroid()){
url = "/android_asset/www/";
}
I've used it to load a 3D model and its textures.
update: ionic 2 beta (version date 10 Aug 2016)
You must add prefix to local url like this: prefix + 'your/local/resource'.
prefix by platform:
ios = '../www/'
android = '../www/'
browser = ''
we can create an urlResolver provider to do this job.
notice: only change url in *.ts code to access local resource, don's do this with remote url or in html code.
Have fun and good luck with beta version.
An Starter Ioner
It is possible to access local resources using $http.get.
If the json file is located in www/js/data.json. You can access using
js/data.json
Do not use ../js/data.json. Using that only works in the local browser. Use js/data.json will work on both local browser and iOS device for Cordova.
In my old version of joomla I used "menu-link" and named the subdirectory /xxx/
All the URLs are on that subdirectory also google knows that.
so :
/xxx/jantje
/xxx/pietje
/xxx/enverder
etc.
Now... a new version of Joomla (only "menu-alias" available) and a new website and it is not possible to place that subdirectory in front of all the menu items ... :(
And I dont want the urls to change.
Joomla makes from /xxx/ a name with a dash --> xxx-
so :
xxx-jantje
xxx-pietje
xxx-enverder
Does anybody know how to solve this? I really like the URLS to stay with the subdirectoryname in it.
Thnks in advance!
The problem is solved by :
comment-out the line 95 from: ./libraries/joomla/filter/output.php
//$str = trim(JString::strtolower($str));
and change to:
$str = trim($str);
comment-out the line 370 from: ./libraries/joomla/filter/language.php
//$string = JString::strtolower($string));
Now you can use in the alias also characters like /.