pile_js / AdguardTeam__AdGuardForSafari.jsonl
Hamhams's picture
commit files to HF hub
c7f4bd0
raw
history blame
53.2 kB
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/notarize.py","language":"python","identifier":"get_user_configuration","parameters":"()","argument_list":"","return_statement":"","docstring":"Reads developer configuration","docstring_summary":"Reads developer configuration","docstring_tokens":["Reads","developer","configuration"],"function":"def get_user_configuration():\n \"\"\"Reads developer configuration\n \"\"\"\n path = os.path.join(CURRENT_DIR, DEVCONFIG_PATH)\n if not os.path.exists(path):\n raise ValueError(\"{0} does not exist!\".format(path))\n\n with open(path, 'r') as file:\n data = file.read()\n config_json = json.loads(data)\n username = config_json[\"AC_USERNAME\"]\n keychain_record = config_json[\"AC_PASSWORD\"]\n return (username, keychain_record)","function_tokens":["def","get_user_configuration","(",")",":","path","=","os",".","path",".","join","(","CURRENT_DIR",",","DEVCONFIG_PATH",")","if","not","os",".","path",".","exists","(","path",")",":","raise","ValueError","(","\"{0} does not exist!\"",".","format","(","path",")",")","with","open","(","path",",","'r'",")","as","file",":","data","=","file",".","read","(",")","config_json","=","json",".","loads","(","data",")","username","=","config_json","[","\"AC_USERNAME\"","]","keychain_record","=","config_json","[","\"AC_PASSWORD\"","]","return","(","username",",","keychain_record",")"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/notarize.py#L26-L38"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/notarize.py","language":"python","identifier":"create_zip_archive","parameters":"(path)","argument_list":"","return_statement":"return zip_path","docstring":"Notary service accepts ZIP archives so we should prepare one","docstring_summary":"Notary service accepts ZIP archives so we should prepare one","docstring_tokens":["Notary","service","accepts","ZIP","archives","so","we","should","prepare","one"],"function":"def create_zip_archive(path):\n \"\"\"Notary service accepts ZIP archives so we should prepare one\n \"\"\"\n zip_path = os.path.join(TEMP_DIR, \"to_notarize.zip\")\n\n # Create a ZIP archive suitable for altool.\n result = subprocess.run([\n \"\/usr\/bin\/ditto\",\n \"-c\", \"-k\", \"--keepParent\",\n path,\n zip_path\n ], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n if result.returncode != 0:\n print(\"out: {0}\".format(result.stdout))\n print(\"out: {0}\".format(result.stderr))\n raise ChildProcessError(\"failed to find archive the archive\")\n\n print(\"Archive for notary: {0}\".format(zip_path))\n return zip_path","function_tokens":["def","create_zip_archive","(","path",")",":","zip_path","=","os",".","path",".","join","(","TEMP_DIR",",","\"to_notarize.zip\"",")","# Create a ZIP archive suitable for altool.","result","=","subprocess",".","run","(","[","\"\/usr\/bin\/ditto\"",",","\"-c\"",",","\"-k\"",",","\"--keepParent\"",",","path",",","zip_path","]",",","stdout","=","subprocess",".","PIPE",",","stderr","=","subprocess",".","PIPE",")","if","result",".","returncode","!=","0",":","print","(","\"out: {0}\"",".","format","(","result",".","stdout",")",")","print","(","\"out: {0}\"",".","format","(","result",".","stderr",")",")","raise","ChildProcessError","(","\"failed to find archive the archive\"",")","print","(","\"Archive for notary: {0}\"",".","format","(","zip_path",")",")","return","zip_path"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/notarize.py#L41-L59"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/notarize.py","language":"python","identifier":"get_notarization_info","parameters":"(request_uuid)","argument_list":"","return_statement":"","docstring":"Checks the status of the submission to the notary service\n\n Arguments:\n request_uuid -- ID of the submission","docstring_summary":"Checks the status of the submission to the notary service","docstring_tokens":["Checks","the","status","of","the","submission","to","the","notary","service"],"function":"def get_notarization_info(request_uuid):\n \"\"\"Checks the status of the submission to the notary service\n\n Arguments:\n request_uuid -- ID of the submission\n \"\"\"\n\n (account, keychain_record) = get_user_configuration()\n\n result = subprocess.run([\n \"xcrun\",\n \"altool\",\n \"--notarization-info\",\n request_uuid,\n \"-u\",\n account,\n \"-p\",\n \"@keychain:{0}\".format(keychain_record)\n ], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n if result.returncode != 0:\n print(\"out: {0}\".format(result.stdout))\n raise ChildProcessError(\"failed to check the submission status\")\n\n for line_bytes in result.stdout.splitlines():\n line = line_bytes.decode(\"utf-8\").strip()\n if line.startswith(\"Status:\"):\n parts = line.split(\":\", 2)\n status = parts[1].strip()\n return status\n\n print(\"out: {0}\".format(result.stdout.decode(\"utf-8\")))\n raise ChildProcessError(\"got invalid response from the notary service\")","function_tokens":["def","get_notarization_info","(","request_uuid",")",":","(","account",",","keychain_record",")","=","get_user_configuration","(",")","result","=","subprocess",".","run","(","[","\"xcrun\"",",","\"altool\"",",","\"--notarization-info\"",",","request_uuid",",","\"-u\"",",","account",",","\"-p\"",",","\"@keychain:{0}\"",".","format","(","keychain_record",")","]",",","stdout","=","subprocess",".","PIPE",",","stderr","=","subprocess",".","STDOUT",")","if","result",".","returncode","!=","0",":","print","(","\"out: {0}\"",".","format","(","result",".","stdout",")",")","raise","ChildProcessError","(","\"failed to check the submission status\"",")","for","line_bytes","in","result",".","stdout",".","splitlines","(",")",":","line","=","line_bytes",".","decode","(","\"utf-8\"",")",".","strip","(",")","if","line",".","startswith","(","\"Status:\"",")",":","parts","=","line",".","split","(","\":\"",",","2",")","status","=","parts","[","1","]",".","strip","(",")","return","status","print","(","\"out: {0}\"",".","format","(","result",".","stdout",".","decode","(","\"utf-8\"",")",")",")","raise","ChildProcessError","(","\"got invalid response from the notary service\"",")"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/notarize.py#L80-L111"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/notarize.py","language":"python","identifier":"submit_to_notary","parameters":"(path, bundle_id)","argument_list":"","return_statement":"","docstring":"Submits the zip archive to the notary service.\n\n Returns RequestUUID that is necessary to staple the app once\n the notarization process is completed.","docstring_summary":"Submits the zip archive to the notary service.","docstring_tokens":["Submits","the","zip","archive","to","the","notary","service","."],"function":"def submit_to_notary(path, bundle_id):\n \"\"\"Submits the zip archive to the notary service.\n\n Returns RequestUUID that is necessary to staple the app once\n the notarization process is completed.\n \"\"\"\n print(\"Submitting {0} to the notary service\".format(path))\n (account, keychain_record) = get_user_configuration()\n\n result = subprocess.run([\n \"xcrun\",\n \"altool\",\n \"--notarize-app\",\n \"--primary-bundle-id\",\n bundle_id,\n \"--asc-provider\",\n DEVELOPMENT_TEAM,\n \"-u\",\n account,\n \"-p\",\n \"@keychain:{0}\".format(keychain_record),\n \"-f\",\n path,\n \"-t\",\n \"osx\"\n ], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n if result.returncode != 0:\n print(\"out: {0}\".format(result.stdout))\n raise ChildProcessError(\"failed to submit the archive\")\n\n for line_bytes in result.stdout.splitlines():\n line = line_bytes.decode(\"utf-8\").strip()\n if line.startswith(\"RequestUUID\"):\n parts = line.split(\"=\", 2)\n request_uuid = parts[1].strip()\n return request_uuid\n\n print(\"out: {0}\".format(result.stdout.decode(\"utf-8\")))\n raise ChildProcessError(\"cannot find RequestUUID in the notary service response\")","function_tokens":["def","submit_to_notary","(","path",",","bundle_id",")",":","print","(","\"Submitting {0} to the notary service\"",".","format","(","path",")",")","(","account",",","keychain_record",")","=","get_user_configuration","(",")","result","=","subprocess",".","run","(","[","\"xcrun\"",",","\"altool\"",",","\"--notarize-app\"",",","\"--primary-bundle-id\"",",","bundle_id",",","\"--asc-provider\"",",","DEVELOPMENT_TEAM",",","\"-u\"",",","account",",","\"-p\"",",","\"@keychain:{0}\"",".","format","(","keychain_record",")",",","\"-f\"",",","path",",","\"-t\"",",","\"osx\"","]",",","stdout","=","subprocess",".","PIPE",",","stderr","=","subprocess",".","STDOUT",")","if","result",".","returncode","!=","0",":","print","(","\"out: {0}\"",".","format","(","result",".","stdout",")",")","raise","ChildProcessError","(","\"failed to submit the archive\"",")","for","line_bytes","in","result",".","stdout",".","splitlines","(",")",":","line","=","line_bytes",".","decode","(","\"utf-8\"",")",".","strip","(",")","if","line",".","startswith","(","\"RequestUUID\"",")",":","parts","=","line",".","split","(","\"=\"",",","2",")","request_uuid","=","parts","[","1","]",".","strip","(",")","return","request_uuid","print","(","\"out: {0}\"",".","format","(","result",".","stdout",".","decode","(","\"utf-8\"",")",")",")","raise","ChildProcessError","(","\"cannot find RequestUUID in the notary service response\"",")"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/notarize.py#L114-L152"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/notarize.py","language":"python","identifier":"notarize","parameters":"(path, bundle_id)","argument_list":"","return_statement":"return","docstring":"This function does the actual notary process\n\n Arguments:\n path -- path to the file or app to notarize","docstring_summary":"This function does the actual notary process","docstring_tokens":["This","function","does","the","actual","notary","process"],"function":"def notarize(path, bundle_id):\n \"\"\"This function does the actual notary process\n\n Arguments:\n path -- path to the file or app to notarize\n \"\"\"\n\n print(\"Start notarizing {0}\".format(path))\n\n path_for_notary = path\n if os.path.isdir(path):\n path_for_notary = create_zip_archive(path)\n\n request_uuid = submit_to_notary(path_for_notary, bundle_id)\n print(\"Request UUID is {0}, now we wait for the notarization to complete\".format(request_uuid))\n wait_until_success(request_uuid)\n\n print(\"Notarization is complete, now staple the app or file\")\n\n result = subprocess.run([\n \"xcrun\",\n \"stapler\",\n \"staple\",\n path\n ], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n\n print(\"out: {0}\".format(result.stdout.decode(\"utf-8\")))\n\n if result.returncode != 0:\n raise ChildProcessError(\"failed to staple the archive\")\n\n return","function_tokens":["def","notarize","(","path",",","bundle_id",")",":","print","(","\"Start notarizing {0}\"",".","format","(","path",")",")","path_for_notary","=","path","if","os",".","path",".","isdir","(","path",")",":","path_for_notary","=","create_zip_archive","(","path",")","request_uuid","=","submit_to_notary","(","path_for_notary",",","bundle_id",")","print","(","\"Request UUID is {0}, now we wait for the notarization to complete\"",".","format","(","request_uuid",")",")","wait_until_success","(","request_uuid",")","print","(","\"Notarization is complete, now staple the app or file\"",")","result","=","subprocess",".","run","(","[","\"xcrun\"",",","\"stapler\"",",","\"staple\"",",","path","]",",","stdout","=","subprocess",".","PIPE",",","stderr","=","subprocess",".","STDOUT",")","print","(","\"out: {0}\"",".","format","(","result",".","stdout",".","decode","(","\"utf-8\"",")",")",")","if","result",".","returncode","!=","0",":","raise","ChildProcessError","(","\"failed to staple the archive\"",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/notarize.py#L155-L186"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"changeEncoding","parameters":"(file)","argument_list":"","return_statement":"","docstring":"Changes encoding of file from UTF-16 to UTF-8","docstring_summary":"Changes encoding of file from UTF-16 to UTF-8","docstring_tokens":["Changes","encoding","of","file","from","UTF","-","16","to","UTF","-","8"],"function":"def changeEncoding(file):\n print(\"change encoding of file {0} from utf-16 to utf-8\".format(file))\n \"\"\" Changes encoding of file from UTF-16 to UTF-8\n \"\"\"\n with open(file, \"rb\") as f:\n with open(\"temp.strings\", \"wb\") as f2:\n content = f.read().decode('utf-16')\n f2.write(content.lstrip().encode('utf-8'))\n shutil.move(\"temp.strings\", file)","function_tokens":["def","changeEncoding","(","file",")",":","print","(","\"change encoding of file {0} from utf-16 to utf-8\"",".","format","(","file",")",")","with","open","(","file",",","\"rb\"",")","as","f",":","with","open","(","\"temp.strings\"",",","\"wb\"",")","as","f2",":","content","=","f",".","read","(",")",".","decode","(","'utf-16'",")","f2",".","write","(","content",".","lstrip","(",")",".","encode","(","'utf-8'",")",")","shutil",".","move","(","\"temp.strings\"",",","file",")"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L75-L83"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"upload_file","parameters":"(path, format, language, file_name)","argument_list":"","return_statement":"return","docstring":"Uploads the specified file to the translation API\n\n Arguments:\n path -- path to the file to upload\n format -- format of the file (for instance, 'strings' or 'json')\n language -- file language\n file_name -- name of the file in the translation system","docstring_summary":"Uploads the specified file to the translation API","docstring_tokens":["Uploads","the","specified","file","to","the","translation","API"],"function":"def upload_file(path, format, language, file_name):\n \"\"\"Uploads the specified file to the translation API\n\n Arguments:\n path -- path to the file to upload\n format -- format of the file (for instance, 'strings' or 'json')\n language -- file language\n file_name -- name of the file in the translation system\n \"\"\"\n files = {\"file\": open(path, \"rb\")}\n values = {\n \"format\": format,\n \"language\": language,\n \"filename\": file_name,\n \"project\": TWOSKY_CONFIG[\"project_id\"]\n }\n\n print(\"Uploading {0}\/{1} to the translation system\".format(language, file_name))\n result = requests.post(API_UPLOAD_URL, files=files, data=values)\n result_text = result.text\n\n if result.status_code != 200:\n raise ConnectionError(\"Could not upload. Response status={0}\\n{1}\".format(result.status_code, result_text))\n\n print(\"Response: {0}\".format(result_text))\n result_json = json.loads(result_text)\n if result_json['ok'] != True:\n raise ConnectionError(\"Could not upload. Response status={0}\\n{1}\".format(result.status_code, result_text))\n return","function_tokens":["def","upload_file","(","path",",","format",",","language",",","file_name",")",":","files","=","{","\"file\"",":","open","(","path",",","\"rb\"",")","}","values","=","{","\"format\"",":","format",",","\"language\"",":","language",",","\"filename\"",":","file_name",",","\"project\"",":","TWOSKY_CONFIG","[","\"project_id\"","]","}","print","(","\"Uploading {0}\/{1} to the translation system\"",".","format","(","language",",","file_name",")",")","result","=","requests",".","post","(","API_UPLOAD_URL",",","files","=","files",",","data","=","values",")","result_text","=","result",".","text","if","result",".","status_code","!=","200",":","raise","ConnectionError","(","\"Could not upload. Response status={0}\\n{1}\"",".","format","(","result",".","status_code",",","result_text",")",")","print","(","\"Response: {0}\"",".","format","(","result_text",")",")","result_json","=","json",".","loads","(","result_text",")","if","result_json","[","'ok'","]","!=","True",":","raise","ConnectionError","(","\"Could not upload. Response status={0}\\n{1}\"",".","format","(","result",".","status_code",",","result_text",")",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L85-L113"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"download_file","parameters":"(file_name, language, format, path)","argument_list":"","return_statement":"return","docstring":"Downloads the specified file from the translations system\n\n Arguments:\n file_name -- name of the file in the translations system\n language -- language to download\n format -- format of the file (for instance, 'strings' or 'json')\n path -- destination path where the file is to be written","docstring_summary":"Downloads the specified file from the translations system","docstring_tokens":["Downloads","the","specified","file","from","the","translations","system"],"function":"def download_file(file_name, language, format, path):\n \"\"\"Downloads the specified file from the translations system\n\n Arguments:\n file_name -- name of the file in the translations system\n language -- language to download\n format -- format of the file (for instance, 'strings' or 'json')\n path -- destination path where the file is to be written\n \"\"\"\n print(\"Downloading {0}\/{1} from the translation system\".format(language, file_name))\n\n params = {\n \"filename\": file_name,\n \"format\": format,\n \"project\": TWOSKY_CONFIG[\"project_id\"],\n \"language\": language\n }\n result = requests.get(API_DOWNLOAD_URL, params=params)\n if result.status_code != 200:\n raise ConnectionError(\"Could not download. Response status={0}\\n{1}\".format(result.status_code, result.text))\n\n target_dir = os.path.dirname(path)\n if not os.path.exists(target_dir):\n raise ValueError(\n \"Target directory does not exist: {0}, make sure that you've added this language in XCode\".format(target_dir))\n\n file = open(path, \"wb\")\n file.write(result.content)\n file.close()\n print(\"The file was downloaded to {0}\".format(path))\n return","function_tokens":["def","download_file","(","file_name",",","language",",","format",",","path",")",":","print","(","\"Downloading {0}\/{1} from the translation system\"",".","format","(","language",",","file_name",")",")","params","=","{","\"filename\"",":","file_name",",","\"format\"",":","format",",","\"project\"",":","TWOSKY_CONFIG","[","\"project_id\"","]",",","\"language\"",":","language","}","result","=","requests",".","get","(","API_DOWNLOAD_URL",",","params","=","params",")","if","result",".","status_code","!=","200",":","raise","ConnectionError","(","\"Could not download. Response status={0}\\n{1}\"",".","format","(","result",".","status_code",",","result",".","text",")",")","target_dir","=","os",".","path",".","dirname","(","path",")","if","not","os",".","path",".","exists","(","target_dir",")",":","raise","ValueError","(","\"Target directory does not exist: {0}, make sure that you've added this language in XCode\"",".","format","(","target_dir",")",")","file","=","open","(","path",",","\"wb\"",")","file",".","write","(","result",".","content",")","file",".","close","(",")","print","(","\"The file was downloaded to {0}\"",".","format","(","path",")",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L116-L146"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"xib_to_strings","parameters":"(xib_path, strings_path)","argument_list":"","return_statement":"return","docstring":"Generates a strings file from the specified xib","docstring_summary":"Generates a strings file from the specified xib","docstring_tokens":["Generates","a","strings","file","from","the","specified","xib"],"function":"def xib_to_strings(xib_path, strings_path):\n \"\"\"Generates a strings file from the specified xib\"\"\"\n print(\"Generating {0} file from {1}\".format(strings_path, xib_path))\n result = subprocess.run([\n \"ibtool\",\n \"--generate-strings-file\",\n strings_path,\n xib_path\n ], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n\n if len(result.stdout) > 0:\n print(\"ibtool stdout:\\n{0}\".format(result.stdout))\n\n if len(result.stderr) > 0:\n print(\"ibtool stderr:\\n{0}\".format(result.stderr))\n\n if result.returncode != 0:\n raise ChildProcessError(\n \"failed to generate the .strings file from {0}. Return code {1}.\".format(xib_path, result.returncode))\n\n if not os.path.exists(strings_path):\n raise FileNotFoundError(strings_path)\n\n changeEncoding(strings_path)\n\n # Finished generating strings\n return","function_tokens":["def","xib_to_strings","(","xib_path",",","strings_path",")",":","print","(","\"Generating {0} file from {1}\"",".","format","(","strings_path",",","xib_path",")",")","result","=","subprocess",".","run","(","[","\"ibtool\"",",","\"--generate-strings-file\"",",","strings_path",",","xib_path","]",",","stdout","=","subprocess",".","PIPE",",","stderr","=","subprocess",".","PIPE",")","if","len","(","result",".","stdout",")",">","0",":","print","(","\"ibtool stdout:\\n{0}\"",".","format","(","result",".","stdout",")",")","if","len","(","result",".","stderr",")",">","0",":","print","(","\"ibtool stderr:\\n{0}\"",".","format","(","result",".","stderr",")",")","if","result",".","returncode","!=","0",":","raise","ChildProcessError","(","\"failed to generate the .strings file from {0}. Return code {1}.\"",".","format","(","xib_path",",","result",".","returncode",")",")","if","not","os",".","path",".","exists","(","strings_path",")",":","raise","FileNotFoundError","(","strings_path",")","changeEncoding","(","strings_path",")","# Finished generating strings","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L149-L175"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"strings_to_xib","parameters":"(strings_path, xib_path)","argument_list":"","return_statement":"return","docstring":"Imports strings from the .strings file to the specified .xib","docstring_summary":"Imports strings from the .strings file to the specified .xib","docstring_tokens":["Imports","strings","from","the",".","strings","file","to","the","specified",".","xib"],"function":"def strings_to_xib(strings_path, xib_path):\n \"\"\"Imports strings from the .strings file to the specified .xib\"\"\"\n print(\"Importing strings from {0} to {1}\".format(strings_path, xib_path))\n\n result = subprocess.run([\n \"ibtool\",\n \"--import-strings-file\",\n strings_path,\n xib_path,\n \"--write\",\n xib_path\n ], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n\n if len(result.stdout) > 0:\n print(\"ibtool stdout:\\n{0}\".format(result.stdout))\n\n if len(result.stderr) > 0:\n print(\"ibtool stderr:\\n{0}\".format(result.stderr))\n\n if result.returncode != 0:\n raise ChildProcessError(\n \"failed to import strings from {0}. Return code {1}.\".format(strings_path, result.returncode))\n\n # Finished importing strings\n return","function_tokens":["def","strings_to_xib","(","strings_path",",","xib_path",")",":","print","(","\"Importing strings from {0} to {1}\"",".","format","(","strings_path",",","xib_path",")",")","result","=","subprocess",".","run","(","[","\"ibtool\"",",","\"--import-strings-file\"",",","strings_path",",","xib_path",",","\"--write\"",",","xib_path","]",",","stdout","=","subprocess",".","PIPE",",","stderr","=","subprocess",".","PIPE",")","if","len","(","result",".","stdout",")",">","0",":","print","(","\"ibtool stdout:\\n{0}\"",".","format","(","result",".","stdout",")",")","if","len","(","result",".","stderr",")",">","0",":","print","(","\"ibtool stderr:\\n{0}\"",".","format","(","result",".","stderr",")",")","if","result",".","returncode","!=","0",":","raise","ChildProcessError","(","\"failed to import strings from {0}. Return code {1}.\"",".","format","(","strings_path",",","result",".","returncode",")",")","# Finished importing strings","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L178-L202"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"export_xib","parameters":"(path)","argument_list":"","return_statement":"return","docstring":"Uploads the specified XIB file to the translation system.\n This method first converts the file to the .strings format,\n and then uploads it to the translation system.","docstring_summary":"Uploads the specified XIB file to the translation system.\n This method first converts the file to the .strings format,\n and then uploads it to the translation system.","docstring_tokens":["Uploads","the","specified","XIB","file","to","the","translation","system",".","This","method","first","converts","the","file","to","the",".","strings","format","and","then","uploads","it","to","the","translation","system","."],"function":"def export_xib(path):\n \"\"\"Uploads the specified XIB file to the translation system.\n This method first converts the file to the .strings format,\n and then uploads it to the translation system.\n \"\"\"\n print(\"Exporting {0}\".format(path))\n\n if not os.path.exists(path):\n raise FileNotFoundError(path)\n\n file_name = os.path.basename(path)\n file_name_noext = os.path.splitext(file_name)[0]\n strings_file_name = \"{0}.strings\".format(file_name_noext)\n strings_path = os.path.join(TEMP_DIR, strings_file_name)\n\n # Now we should generate a `.strings` file from this XIB\n xib_to_strings(path, strings_path)\n\n # Now that strings file is generated, we can upload it\n upload_file(strings_path, \"strings\", API_BASELOCALE, strings_file_name)\n return","function_tokens":["def","export_xib","(","path",")",":","print","(","\"Exporting {0}\"",".","format","(","path",")",")","if","not","os",".","path",".","exists","(","path",")",":","raise","FileNotFoundError","(","path",")","file_name","=","os",".","path",".","basename","(","path",")","file_name_noext","=","os",".","path",".","splitext","(","file_name",")","[","0","]","strings_file_name","=","\"{0}.strings\"",".","format","(","file_name_noext",")","strings_path","=","os",".","path",".","join","(","TEMP_DIR",",","strings_file_name",")","# Now we should generate a `.strings` file from this XIB","xib_to_strings","(","path",",","strings_path",")","# Now that strings file is generated, we can upload it","upload_file","(","strings_path",",","\"strings\"",",","API_BASELOCALE",",","strings_file_name",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L205-L225"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"export_localizable_file","parameters":"(path, locale, dir_name)","argument_list":"","return_statement":"return","docstring":"Uploads the specified localizable file to the translation system","docstring_summary":"Uploads the specified localizable file to the translation system","docstring_tokens":["Uploads","the","specified","localizable","file","to","the","translation","system"],"function":"def export_localizable_file(path, locale, dir_name):\n \"\"\"Uploads the specified localizable file to the translation system\"\"\"\n print(\"Exporting {0}\".format(path))\n\n if not os.path.exists(path):\n raise FileNotFoundError(path)\n\n file_name = os.path.basename(path)\n file_ext = os.path.splitext(file_name)[1][1:]\n\n if file_name == \"InfoPlist.strings\":\n file_name = INFO_PLIST_DICTIONARY[dir_name]\n\n # Now upload the file\n upload_file(path, file_ext, locale, file_name)\n return","function_tokens":["def","export_localizable_file","(","path",",","locale",",","dir_name",")",":","print","(","\"Exporting {0}\"",".","format","(","path",")",")","if","not","os",".","path",".","exists","(","path",")",":","raise","FileNotFoundError","(","path",")","file_name","=","os",".","path",".","basename","(","path",")","file_ext","=","os",".","path",".","splitext","(","file_name",")","[","1","]","[","1",":","]","if","file_name","==","\"InfoPlist.strings\"",":","file_name","=","INFO_PLIST_DICTIONARY","[","dir_name","]","# Now upload the file","upload_file","(","path",",","file_ext",",","locale",",","file_name",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L228-L243"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"export_json_file","parameters":"(path, locale)","argument_list":"","return_statement":"return","docstring":"Uploads the specified json file to the translation system","docstring_summary":"Uploads the specified json file to the translation system","docstring_tokens":["Uploads","the","specified","json","file","to","the","translation","system"],"function":"def export_json_file(path, locale):\n \"\"\"Uploads the specified json file to the translation system\"\"\"\n print(\"Exporting {0}\".format(path))\n\n if not os.path.exists(path):\n raise FileNotFoundError(path)\n\n file_name = \"en.json\"\n file_ext = os.path.splitext(file_name)[1][1:]\n\n # Now upload the file\n upload_file(path, file_ext, locale, file_name)\n return","function_tokens":["def","export_json_file","(","path",",","locale",")",":","print","(","\"Exporting {0}\"",".","format","(","path",")",")","if","not","os",".","path",".","exists","(","path",")",":","raise","FileNotFoundError","(","path",")","file_name","=","\"en.json\"","file_ext","=","os",".","path",".","splitext","(","file_name",")","[","1","]","[","1",":","]","# Now upload the file","upload_file","(","path",",","file_ext",",","locale",",","file_name",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L246-L258"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"import_localizable_file","parameters":"(path, locale, dir_name)","argument_list":"","return_statement":"return","docstring":"Imports the specified localizable file from the translation system","docstring_summary":"Imports the specified localizable file from the translation system","docstring_tokens":["Imports","the","specified","localizable","file","from","the","translation","system"],"function":"def import_localizable_file(path, locale, dir_name):\n \"\"\"Imports the specified localizable file from the translation system\"\"\"\n print(\"Importing {0}\".format(path))\n\n file_name = os.path.basename(path)\n file_ext = os.path.splitext(file_name)[1][1:]\n\n if file_name == \"InfoPlist.strings\":\n file_name = INFO_PLIST_DICTIONARY[dir_name]\n\n # Download the file\n download_file(file_name, locale, file_ext, path)\n return","function_tokens":["def","import_localizable_file","(","path",",","locale",",","dir_name",")",":","print","(","\"Importing {0}\"",".","format","(","path",")",")","file_name","=","os",".","path",".","basename","(","path",")","file_ext","=","os",".","path",".","splitext","(","file_name",")","[","1","]","[","1",":","]","if","file_name","==","\"InfoPlist.strings\"",":","file_name","=","INFO_PLIST_DICTIONARY","[","dir_name","]","# Download the file","download_file","(","file_name",",","locale",",","file_ext",",","path",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L261-L273"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"import_json_file","parameters":"(path, locale)","argument_list":"","return_statement":"return","docstring":"Imports the specified json file from the translation system","docstring_summary":"Imports the specified json file from the translation system","docstring_tokens":["Imports","the","specified","json","file","from","the","translation","system"],"function":"def import_json_file(path, locale):\n \"\"\"Imports the specified json file from the translation system\"\"\"\n print(\"Importing {0}\".format(path))\n\n file_name = \"en.json\"\n file_ext = os.path.splitext(file_name)[1][1:]\n\n # Download the file\n download_file(file_name, locale, file_ext, path)\n return","function_tokens":["def","import_json_file","(","path",",","locale",")",":","print","(","\"Importing {0}\"",".","format","(","path",")",")","file_name","=","\"en.json\"","file_ext","=","os",".","path",".","splitext","(","file_name",")","[","1","]","[","1",":","]","# Download the file","download_file","(","file_name",",","locale",",","file_ext",",","path",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L275-L284"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"workaround_json_file","parameters":"(file_path, locale, path)","argument_list":"","return_statement":"return","docstring":"We don't have some locales in xcode, but we need it for Electron, such as zh-cn, zh-tw\n So we gonna duplicate these files\n Referenced issue: https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/issues\/256","docstring_summary":"We don't have some locales in xcode, but we need it for Electron, such as zh-cn, zh-tw\n So we gonna duplicate these files\n Referenced issue: https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/issues\/256","docstring_tokens":["We","don","t","have","some","locales","in","xcode","but","we","need","it","for","Electron","such","as","zh","-","cn","zh","-","tw","So","we","gonna","duplicate","these","files","Referenced","issue",":","https",":","\/\/","github",".","com","\/","AdguardTeam","\/","AdGuardForSafari","\/","issues","\/","256"],"function":"def workaround_json_file(file_path, locale, path):\n \"\"\"We don't have some locales in xcode, but we need it for Electron, such as zh-cn, zh-tw\n So we gonna duplicate these files\n Referenced issue: https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/issues\/256\n \"\"\"\n\n ELECTRON_LOCALES_DICTIONARY = {\n 'zh-Hans' : 'zh-cn',\n 'zh-Hant' : 'zh-tw'\n }\n\n paired_locale = ELECTRON_LOCALES_DICTIONARY.get(locale, '')\n if paired_locale != \"\":\n print(\"Duplicate json for {0} - {1}\".format(locale, paired_locale))\n copy_path = os.path.join(CURRENT_DIR, BASE_PATH, path, \"{0}.json\".format(paired_locale))\n shutil.copyfile(file_path, copy_path)\n\n return","function_tokens":["def","workaround_json_file","(","file_path",",","locale",",","path",")",":","ELECTRON_LOCALES_DICTIONARY","=","{","'zh-Hans'",":","'zh-cn'",",","'zh-Hant'",":","'zh-tw'","}","paired_locale","=","ELECTRON_LOCALES_DICTIONARY",".","get","(","locale",",","''",")","if","paired_locale","!=","\"\"",":","print","(","\"Duplicate json for {0} - {1}\"",".","format","(","locale",",","paired_locale",")",")","copy_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","path",",","\"{0}.json\"",".","format","(","paired_locale",")",")","shutil",".","copyfile","(","file_path",",","copy_path",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L286-L303"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"get_xib_translation_path","parameters":"(path, locale)","argument_list":"","return_statement":"return path","docstring":"Gets path to the XIB file translation given it's relative path\n\n For example, if path is 'ProgramLog\/Base.lproj\/AAProgramLog.xib' and locale is 'de',\n the translation path will be 'ProgramLog\/de.lproj\/AAProgramLog.strings'","docstring_summary":"Gets path to the XIB file translation given it's relative path","docstring_tokens":["Gets","path","to","the","XIB","file","translation","given","it","s","relative","path"],"function":"def get_xib_translation_path(path, locale):\n \"\"\"Gets path to the XIB file translation given it's relative path\n\n For example, if path is 'ProgramLog\/Base.lproj\/AAProgramLog.xib' and locale is 'de',\n the translation path will be 'ProgramLog\/de.lproj\/AAProgramLog.strings'\n \"\"\"\n\n path = path.replace(\"Base.lproj\", \"{0}.lproj\".format(locale))\n path = os.path.splitext(path)[0] + \".strings\"\n return path","function_tokens":["def","get_xib_translation_path","(","path",",","locale",")",":","path","=","path",".","replace","(","\"Base.lproj\"",",","\"{0}.lproj\"",".","format","(","locale",")",")","path","=","os",".","path",".","splitext","(","path",")","[","0","]","+","\".strings\"","return","path"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L306-L315"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"export_localizations","parameters":"()","argument_list":"","return_statement":"return","docstring":"Entry point for the exporting localizations process","docstring_summary":"Entry point for the exporting localizations process","docstring_tokens":["Entry","point","for","the","exporting","localizations","process"],"function":"def export_localizations():\n \"\"\"Entry point for the exporting localizations process\"\"\"\n print(\"Start exporting localizations\")\n\n for path in XIB_FILES:\n file_path = os.path.join(CURRENT_DIR, BASE_PATH, path)\n export_xib(file_path)\n\n for path in LOCALIZABLE_FILES:\n file_name = os.path.basename(path)\n dir_name = os.path.dirname(path)\n file_path = os.path.join(CURRENT_DIR, BASE_PATH, dir_name, \"{0}.lproj\".format(API_BASELOCALE), file_name)\n export_localizable_file(file_path, API_BASELOCALE, dir_name)\n\n for path in JSON_FILES:\n file_path = os.path.join(CURRENT_DIR, BASE_PATH, path, \"{0}.json\".format(API_BASELOCALE))\n export_json_file(file_path, API_BASELOCALE)\n\n print(\"Finished exporting localizations\")\n return","function_tokens":["def","export_localizations","(",")",":","print","(","\"Start exporting localizations\"",")","for","path","in","XIB_FILES",":","file_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","path",")","export_xib","(","file_path",")","for","path","in","LOCALIZABLE_FILES",":","file_name","=","os",".","path",".","basename","(","path",")","dir_name","=","os",".","path",".","dirname","(","path",")","file_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","dir_name",",","\"{0}.lproj\"",".","format","(","API_BASELOCALE",")",",","file_name",")","export_localizable_file","(","file_path",",","API_BASELOCALE",",","dir_name",")","for","path","in","JSON_FILES",":","file_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","path",",","\"{0}.json\"",".","format","(","API_BASELOCALE",")",")","export_json_file","(","file_path",",","API_BASELOCALE",")","print","(","\"Finished exporting localizations\"",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L318-L337"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"export_translations","parameters":"(locale)","argument_list":"","return_statement":"return","docstring":"Exports all existing translations to the specified locale\n to the translation system.","docstring_summary":"Exports all existing translations to the specified locale\n to the translation system.","docstring_tokens":["Exports","all","existing","translations","to","the","specified","locale","to","the","translation","system","."],"function":"def export_translations(locale):\n \"\"\"Exports all existing translations to the specified locale\n to the translation system.\"\"\"\n print(\"Start exporting translations to {0}\".format(locale))\n\n for path in XIB_FILES:\n translation_path = get_xib_translation_path(path, locale)\n file_path = os.path.join(CURRENT_DIR, BASE_PATH, translation_path)\n export_localizable_file(file_path, locale)\n\n for path in LOCALIZABLE_FILES:\n file_path = os.path.join(CURRENT_DIR, BASE_PATH, \"{0}.lproj\".format(locale), path)\n export_localizable_file(file_path, locale)\n\n for path in JSON_FILES:\n file_path = os.path.join(CURRENT_DIR, BASE_PATH, path, \"{0}.json\".format(locale))\n export_json_file(file_path, locale)\n\n print(\"Finished exporting translations to {0}\".format(locale))\n return","function_tokens":["def","export_translations","(","locale",")",":","print","(","\"Start exporting translations to {0}\"",".","format","(","locale",")",")","for","path","in","XIB_FILES",":","translation_path","=","get_xib_translation_path","(","path",",","locale",")","file_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","translation_path",")","export_localizable_file","(","file_path",",","locale",")","for","path","in","LOCALIZABLE_FILES",":","file_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","\"{0}.lproj\"",".","format","(","locale",")",",","path",")","export_localizable_file","(","file_path",",","locale",")","for","path","in","JSON_FILES",":","file_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","path",",","\"{0}.json\"",".","format","(","locale",")",")","export_json_file","(","file_path",",","locale",")","print","(","\"Finished exporting translations to {0}\"",".","format","(","locale",")",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L340-L359"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"export_all_translations","parameters":"()","argument_list":"","return_statement":"return","docstring":"Entry point for the exporting ALL translations process","docstring_summary":"Entry point for the exporting ALL translations process","docstring_tokens":["Entry","point","for","the","exporting","ALL","translations","process"],"function":"def export_all_translations():\n \"\"\"Entry point for the exporting ALL translations process\"\"\"\n print(\"Start exporting ALL translations\")\n for locale in TWOSKY_CONFIG[\"languages\"]:\n export_translations(locale)\n print(\"Finished exporting ALL translations\")\n return","function_tokens":["def","export_all_translations","(",")",":","print","(","\"Start exporting ALL translations\"",")","for","locale","in","TWOSKY_CONFIG","[","\"languages\"","]",":","export_translations","(","locale",")","print","(","\"Finished exporting ALL translations\"",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L362-L368"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"import_localization","parameters":"(locale)","argument_list":"","return_statement":"return","docstring":"Imports translations to the specified language","docstring_summary":"Imports translations to the specified language","docstring_tokens":["Imports","translations","to","the","specified","language"],"function":"def import_localization(locale):\n \"\"\"Imports translations to the specified language\"\"\"\n print(\"Start importing translations to {0}\".format(locale))\n\n for path in XIB_FILES:\n translation_path = get_xib_translation_path(path, locale)\n file_path = os.path.join(CURRENT_DIR, BASE_PATH, translation_path)\n import_localizable_file(file_path, locale, \"\")\n\n for path in LOCALIZABLE_FILES:\n file_name = os.path.basename(path)\n dir_name = os.path.dirname(path)\n file_path = os.path.join(CURRENT_DIR, BASE_PATH, dir_name, \"{0}.lproj\".format(locale), file_name)\n import_localizable_file(file_path, locale, dir_name)\n\n for path in JSON_FILES:\n file_path = os.path.join(CURRENT_DIR, BASE_PATH, path, \"{0}.json\".format(locale))\n import_json_file(file_path, locale)\n workaround_json_file(file_path, locale, path)\n\n print(\"Finished importing translations to {0}\".format(locale))\n return","function_tokens":["def","import_localization","(","locale",")",":","print","(","\"Start importing translations to {0}\"",".","format","(","locale",")",")","for","path","in","XIB_FILES",":","translation_path","=","get_xib_translation_path","(","path",",","locale",")","file_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","translation_path",")","import_localizable_file","(","file_path",",","locale",",","\"\"",")","for","path","in","LOCALIZABLE_FILES",":","file_name","=","os",".","path",".","basename","(","path",")","dir_name","=","os",".","path",".","dirname","(","path",")","file_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","dir_name",",","\"{0}.lproj\"",".","format","(","locale",")",",","file_name",")","import_localizable_file","(","file_path",",","locale",",","dir_name",")","for","path","in","JSON_FILES",":","file_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","path",",","\"{0}.json\"",".","format","(","locale",")",")","import_json_file","(","file_path",",","locale",")","workaround_json_file","(","file_path",",","locale",",","path",")","print","(","\"Finished importing translations to {0}\"",".","format","(","locale",")",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L371-L392"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"import_localizations","parameters":"()","argument_list":"","return_statement":"return","docstring":"Entry point for the importing localizations process","docstring_summary":"Entry point for the importing localizations process","docstring_tokens":["Entry","point","for","the","importing","localizations","process"],"function":"def import_localizations():\n \"\"\"Entry point for the importing localizations process\"\"\"\n print(\"Start importing localizations\")\n for locale in TWOSKY_CONFIG[\"languages\"]:\n import_localization(locale)\n print(\"Finished importing localizations\")\n return","function_tokens":["def","import_localizations","(",")",":","print","(","\"Start importing localizations\"",")","for","locale","in","TWOSKY_CONFIG","[","\"languages\"","]",":","import_localization","(","locale",")","print","(","\"Finished importing localizations\"",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L395-L401"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"update_strings","parameters":"()","argument_list":"","return_statement":"return","docstring":"Entry point for the updating strings from xibs process","docstring_summary":"Entry point for the updating strings from xibs process","docstring_tokens":["Entry","point","for","the","updating","strings","from","xibs","process"],"function":"def update_strings():\n \"\"\"Entry point for the updating strings from xibs process\"\"\"\n print(\"Start updating .strings files\")\n\n for path in XIB_FILES:\n strings_rel_path = get_xib_translation_path(path, API_BASELOCALE)\n strings_path = os.path.join(CURRENT_DIR, BASE_PATH, strings_rel_path)\n xib_path = os.path.join(CURRENT_DIR, BASE_PATH, path)\n xib_to_strings(xib_path, strings_path)\n\n print(\"Finished updating .strings files\")\n return","function_tokens":["def","update_strings","(",")",":","print","(","\"Start updating .strings files\"",")","for","path","in","XIB_FILES",":","strings_rel_path","=","get_xib_translation_path","(","path",",","API_BASELOCALE",")","strings_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","strings_rel_path",")","xib_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","path",")","xib_to_strings","(","xib_path",",","strings_path",")","print","(","\"Finished updating .strings files\"",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L404-L415"}
{"nwo":"AdguardTeam\/AdGuardForSafari","sha":"24c86196548d7d60cda17b54fd64b0478d6a9068","path":"Scripts\/localization.py","language":"python","identifier":"update_xibs","parameters":"()","argument_list":"","return_statement":"return","docstring":"Entry point for the updating xibs from strings process","docstring_summary":"Entry point for the updating xibs from strings process","docstring_tokens":["Entry","point","for","the","updating","xibs","from","strings","process"],"function":"def update_xibs():\n \"\"\"Entry point for the updating xibs from strings process\"\"\"\n print(\"Start updating .xib files\")\n\n for path in XIB_FILES:\n strings_rel_path = get_xib_translation_path(path, API_BASELOCALE)\n strings_path = os.path.join(CURRENT_DIR, BASE_PATH, strings_rel_path)\n xib_path = os.path.join(CURRENT_DIR, BASE_PATH, path)\n strings_to_xib(strings_path, xib_path)\n\n print(\"Finished updating .xib files\")\n return","function_tokens":["def","update_xibs","(",")",":","print","(","\"Start updating .xib files\"",")","for","path","in","XIB_FILES",":","strings_rel_path","=","get_xib_translation_path","(","path",",","API_BASELOCALE",")","strings_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","strings_rel_path",")","xib_path","=","os",".","path",".","join","(","CURRENT_DIR",",","BASE_PATH",",","path",")","strings_to_xib","(","strings_path",",","xib_path",")","print","(","\"Finished updating .xib files\"",")","return"],"url":"https:\/\/github.com\/AdguardTeam\/AdGuardForSafari\/blob\/24c86196548d7d60cda17b54fd64b0478d6a9068\/Scripts\/localization.py#L418-L429"}