CSV delimiter based on the detected locale
Change the CSV delimiter, using the detected browser locale, of the downloaded files using dataframe toolbar.
Describe your changes
Changed the constant comma used to create the downloadable file with the delimiter used for the local detected.
@LukasMasuch I'm sorry if i tag you at random, i have developed this easy fix for the csv based on the locale, i think it could be helpful, in case i could have some feedback about anyone interested in this addition in next releases? Thanks.
@ubertidavide Thanks for the PR :)
I will start some internal discussions about this change, but the outcome might be that we won't merge something right now. We have been discussing localization internally a couple of times, and we will likely start tackling this more holistically across all Streamlit aspects within the next few months. At the moment, many aspects of Streamlit are not properly localized :( And just localizing a couple of aspects might lead to more confusion.
In the long term, I think we might need a setting in Streamlit that makes it possible to either set a static locale that is used for everything in Streamlit or configure it via "auto" to localize everything to the user's locale browser settings.
Btw. there might be an even easier, more flexible way to get the correct locale list separator:
const CSV_DELIMITER = ['', ''].toLocaleString()
@ubertidavide Thanks for the PR :)
I will start some internal discussions about this change, but the outcome might be that we won't merge something right now. We have been discussing localization internally a couple of times, and we will likely start tackling this more holistically across all Streamlit aspects within the next few months. At the moment, many aspects of Streamlit are not properly localized :( And just localizing a couple of aspects might lead to more confusion.
In the long term, I think we might need a setting in Streamlit that makes it possible to either set a static locale that is used for everything in Streamlit or configure it via
"auto"to localize everything to the user's locale browser settings.Btw. there might be an even easier, more flexible way to get the correct locale list separator:
const CSV_DELIMITER = ['', ''].toLocaleString()
Thank you so much for the quick answer, the main problem starts because we need to download the table's data, but normally excel infer the csv delimiter based on the locale used by the PC, and that give a big problem of user experience. We must convert manually every file downloaded... Then i have a sort of "improvement" that may be done in future if it could be helpful to someone, if the download data have a callback in streamlit using the backend and it's not a file generated from the frontend but an api download with the data of the dataframe, in this method the apparence of the only download dataframe could be changed in the streamlit callback in order to download the modified and styled dataframe as file, and also the default dataframe to_excel or to_csv and parameters like thousands, decimal and separator like the download_button in streamlit could be used to set the downloaded file format. Thanks for the code improvement, i' have just updated the PR code.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.