how do i change flask-admin's locale? - flask-admin

I wanner change the locale, like:
locale='zh_CN'
not admin's application's locale, I need change flask-admin's locale code.

Try add parameter
?lang=zh_CN
to the end of the url request.
If that work, you may add
set $args $args&lang=zh_CN;
to your nginx conf file.

Related

Office URI schemes, new file from template(nft) not saving the file in provided location

We are creating a new file from template as specified in the Office Uri Schemes documentation.
As per the documentation we can give an optional parameter with |s to specify the default path offered as a save location when the file is first saved. The only restriction is that if the optional default save location is supplied, it must be pointing to the same host name as the template.
We are using Office 365 group drive to save the template and the default save location(for newly generated file) is also in the same group drive. But it is not picking the default save location as specified.
Following is the URI that we are testing.
ms-word:nft|u|https://figg.sharepoint.com/sites/1dev/Shared%20Documents/Config/Files/Minutes.dotx|s|https://figg.sharepoint.com/sites/1dev/Shared%20Documents/Dest
The above url when opened generate a new file from template but it did not give the default save location specified in the command when we try to save the file.
Any help if how to fix this would be very helpful.
Are you sure about your save URL ? It looks truncated as Dest...
If it's correct, make sure that it ends with a forward slash, like this:
ms-word:nft|u|https://figg.sharepoint.com/sites/1dev/Shared%20Documents/Config/Files/Minutes.dotx|s|https://figg.sharepoint.com/sites/1dev/Shared%20Documents/Dest/
You also must make sure you have the correct permissions to write back to that particular document library
HTH

Locale function?

Is there a server side function in SFCC to get Locale? Thank you!!!
I am localizing a sfcc site, and need to update the en_gb locale in thousands of hard coded strings (in a xml file obtained from Merchant Tools > Content > Import & Export) to server side code that will dynamically insert the correct locale, i.e. en_gb, fr_fr, etc. I know there are a few server side functions like $URL()$ that can run before content is rendered. Is there one to get the Locale?
here is what I have now... https://www.example.com/en_gb/holiday-sale-event/?prefn1=productType&prefv1=Shoes
ideally, I'm looking for something like: https://www.example.com/$Locale()$/holiday-sale-event/?prefn1=productType&prefv1=Shoes
Expected results would be:
https://www.example.com/en_gb/holiday-sale-event/?prefn1=productType&prefv1=Shoes
https://www.example.com/en_nl/holiday-sale-event/?prefn1=productType&prefv1=Shoes
https://www.example.com/fr_fr/holiday-sale-event/?prefn1=productType&prefv1=Shoes
https://www.example.com/de_de/holiday-sale-event/?prefn1=productType&prefv1=Shoes
...etc., depending on locale.
You should be using $url()$ to generate the URL which will automatically populate the correct locale string in the URL.
Assuming that the above examples are links for a refined category search within a category with the ID: holiday-sales-event Then your first example would be represented as such:
$url(Search-Show,cgid,holiday-sales-event,prefn1,productType,prefv1,shoes)$
This would produce the correct localized URL for whatever locale context the content is being rendered for.
Since the “holiday-sales-event” portion of the URL is likely to be localized itself, then your intended approach would result in either 404s or redirects at the very least.
you can get the current locale with request.locale
var currentLocale = request.locale;

TYPO3 - Realurl default Settings overwrite?

How can I overwrite the default settings of the TYPO3 extension realurl with my own extension?
this dont work:
// RealUrl Config File
if (!isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['realurl']['configFile'])
|| empty(trim($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['realurl']['configFile']))
) {
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['realurl']['configFile'] = 'typo3conf/ext/xxx/Resources/Private/Hooks/realurl_conf.php';
}
How can I use this?
Probably the problem is that realurl is inialized and executed very early (it's the first process which needs to translate the speaking url to url parameter which decide which page and which plugin is rendered).
Your attempt to modify the assignment which is done normaly in typo3conf/LocalConfiguration.php could not be attached to that file as it is just an array, which gets written anew automatically every now and then.
You might add that to typo3conf/AdditionalConfiguration.php.
But why don't you request an admin to assign the path to the config-file in your extension in the realurl EM-config by hand?

How to sanitize a $_GET on Typo3 extension?

I have an extension that access a file directory. I use an ajax function to send the path that needs to be access to the controller and in the controller I use a $_GET cause I haven't figure it out how to make it work otherwise.
$image_file_path = $_GET["url_region"];
$d = dir($image_file_path) or die("File not found!");
But of course when you request for something else like ../../.. you can access all other directories.
Could you suggest me a way to sanitize this? Please!
You should provide a cHash as URL parameter and let TYPO3 verify that. This way you can be sure the URL has been generated by TYPO3 itself and thus is valid.
You should consider using t3lib_div::_GET() which unescapes the parameters regardless what php.ini magic_quotes says.
You easily could use a regex to catch all "../" - values of the parameter. The other way could be, that the available paths being defined in a array, or something else, to check up the right access.

Get contents of password variable in response file

I'm evaluating install4j. The installer I'm trying to create uses a passwort text field. The value of this field should be written to the response var file as encoded value. Additional the installer must allow two installation paths:
a normal path ("advanced") that allows the user to see every screen and check/enter every value - using this path, the password field works fine.
a simple path that should use all values of a former installation that was succesful, to allow the user to start an update installation without seeing all screens.
Using the simple path (without showing the screen that contains the password field) it seems that at installation time only the encoded variable ("passwordField".encoded) is available but not the "real" password variable. Is there a chance to get the "real" password variable without showing the screen that contains this variable - maybe by using some kind of "decoding method"?
Thank you very much for your help!
Frank
Add another password component with the same variable to a screen that is shown on the simple path and set its visibility expression to "false". Then that invisible component will update the variable with the decoded value.