how to pass here target languages @router.post("/multi-local-from-file") async def…
Jump to turn (6)
- 1how to pass here target languages @router.post("/multi-local-from-file") async d
- 2using js
- 3how send it with uploded file Dropzone.autoDiscover = false; $(document).ready(f
- 4I don't want hide select languages. I want to user choose target languages in se
- 5in your code dropzone inactive and i can't drop file there
- 6could you collect all code together
- User
how to pass here target languages @router.post("/multi-local-from-file") async def multi_local_from_file( data: UploadFile, target_lang_list: list[str] = LANGUAGE_LIST, source_lang: str = "en", ) -> StreamingResponse: """ Translates the arb file into several languages
code- **data**: arb file - **source_lang**: original language - **target_lang_list**: languages after translation """ data_dict = get_dict_from_arb_file(data.file) tmpdir = tempfile.TemporaryDirectory() target_lang_list = comma_str_to_list(target_lang_list) file_paths = multi_lang_translate(source_lang, target_lang_list, data_dict, tmpdir) zip_io = save_files_to_zip(file_paths) return StreamingResponse( iter([zip_io.getvalue()]), media_type="application/x-zip-compressed", headers={"Content-Disposition": f"attachment; filename=translated.zip"}, ) from here <select id="target_lang_list" name="target_lang_list" class="selectpicker" multiple data-live-search="true" required> {% for key, value in languages.items() %} <option value="{{ key }}">{{ value }}</option> {% endfor %} </select>