Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2179f8d

Browse files
Update translations
1 parent 2d75070 commit 2179f8d

File tree

3 files changed

+90
-4
lines changed

3 files changed

+90
-4
lines changed

library/email.examples.po

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ msgid ""
1111
msgstr ""
1212
"Project-Id-Version: Python 3.12\n"
1313
"Report-Msgid-Bugs-To: \n"
14-
"POT-Creation-Date: 2025-04-25 14:54+0000\n"
14+
"POT-Creation-Date: 2025-05-16 15:32+0000\n"
1515
"PO-Revision-Date: 2024-05-11 00:33+0000\n"
1616
"Last-Translator: Rafael Fontenelle <[email protected]>, 2025\n"
1717
"Language-Team: Portuguese (Brazil) (https://app.transifex.com/python-doc/"
@@ -611,6 +611,92 @@ msgid ""
611611
"# Of course, there are lots of email messages that could break this simple\n"
612612
"# minded program, but it will handle the most common ones.\n"
613613
msgstr ""
614+
"import os\n"
615+
"import sys\n"
616+
"import tempfile\n"
617+
"import mimetypes\n"
618+
"import webbrowser\n"
619+
"\n"
620+
"# Importa os módulos de e-mail que precisaremos\n"
621+
"from email import policy\n"
622+
"from email.parser import BytesParser\n"
623+
"\n"
624+
"\n"
625+
"def magic_html_parser(html_text, partfiles):\n"
626+
" \"\"\"Retorna HTML com segurança e link para partfiles.\n"
627+
"\n"
628+
" Reescreve os atributos href=\"cid:....\" para apontar aos arquivos em "
629+
"partfiles.\n"
630+
" Embora não seja trivial, isso deve ser possível usando html.parser.\n"
631+
" \"\"\"\n"
632+
" raise NotImplementedError(\"Add the magic needed\")\n"
633+
"\n"
634+
"\n"
635+
"# Em um programa real, você pegaria o nome de arquivo a partir dos "
636+
"argumentos.\n"
637+
"with open('outgoing.msg', 'rb') as fp:\n"
638+
" msg = BytesParser(policy=policy.default).parse(fp)\n"
639+
"\n"
640+
"# Agora os itens de cabeçalho podem ser acessados como um dicionário e\n"
641+
"# qualquer caractere não-ASCII será convertido para unicode:\n"
642+
"print('To:', msg['to'])\n"
643+
"print('From:', msg['from'])\n"
644+
"print('Subject:', msg['subject'])\n"
645+
"\n"
646+
"# Se quisermos imprimir uma prévia do conteúdo da mensagem, podemos\n"
647+
"# extrair o conteúdo menos formatado e imprimir as três primeiras linhas.\n"
648+
"# É claro que, se a mensagem não tiver uma parte de texto simples,\n"
649+
"# imprimir as três primeiras linhas de HTML provavelmente será inútil,\n"
650+
"# mas este é apenas um exemplo conceitual.\n"
651+
"simplest = msg.get_body(preferencelist=('plain', 'html'))\n"
652+
"print()\n"
653+
"print(''.join(simplest.get_content().splitlines(keepends=True)[:3]))\n"
654+
"\n"
655+
"ans = input(\"View full message?\")\n"
656+
"if ans.lower()[0] == 'n':\n"
657+
" sys.exit()\n"
658+
"\n"
659+
"# Podemos extrair a alternativa richest para exibi-la:\n"
660+
"richest = msg.get_body()\n"
661+
"partfiles = {}\n"
662+
"if richest['content-type'].maintype == 'text':\n"
663+
" if richest['content-type'].subtype == 'plain':\n"
664+
" for line in richest.get_content().splitlines():\n"
665+
" print(line)\n"
666+
" sys.exit()\n"
667+
" elif richest['content-type'].subtype == 'html':\n"
668+
" body = richest\n"
669+
" else:\n"
670+
" print(\"Don't know how to display {}\".format(richest."
671+
"get_content_type()))\n"
672+
" sys.exit()\n"
673+
"elif richest['content-type'].content_type == 'multipart/related':\n"
674+
" body = richest.get_body(preferencelist=('html'))\n"
675+
" for part in richest.iter_attachments():\n"
676+
" fn = part.get_filename()\n"
677+
" if fn:\n"
678+
" extension = os.path.splitext(part.get_filename())[1]\n"
679+
" else:\n"
680+
" extension = mimetypes.guess_extension(part.get_content_type())\n"
681+
" with tempfile.NamedTemporaryFile(suffix=extension, delete=False) as "
682+
"f:\n"
683+
" f.write(part.get_content())\n"
684+
" # remove novamente o <> para ir da forma email de cid para "
685+
"html.\n"
686+
" partfiles[part['content-id'][1:-1]] = f.name\n"
687+
"else:\n"
688+
" print(\"Don't know how to display {}\".format(richest."
689+
"get_content_type()))\n"
690+
" sys.exit()\n"
691+
"with tempfile.NamedTemporaryFile(mode='w', delete=False) as f:\n"
692+
" f.write(magic_html_parser(body.get_content(), partfiles))\n"
693+
"webbrowser.open(f.name)\n"
694+
"os.remove(f.name)\n"
695+
"for fn in partfiles.values():\n"
696+
" os.remove(fn)\n"
697+
"\n"
698+
"# É claro que há muitas mensagens de e-mail que podem quebrar\n"
699+
"# esse simples programa, mas ele lidará com as mais comuns.\n"
614700

615701
#: ../../library/email.examples.rst:52
616702
msgid "Up to the prompt, the output from the above is:"

potodo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070

7171

7272

73-
# library (63.14% done)
73+
# library (63.15% done)
7474

7575
- 2to3.po 121 / 132 ( 91.0% translated).
7676
- array.po 77 / 84 ( 91.0% translated).
@@ -109,7 +109,7 @@
109109
- email.compat32-message.po 6 / 115 ( 5.0% translated).
110110
- email.contentmanager.po 9 / 42 ( 21.0% translated).
111111
- email.errors.po 6 / 26 ( 23.0% translated).
112-
- email.examples.po 16 / 20 ( 80.0% translated).
112+
- email.examples.po 17 / 20 ( 85.0% translated).
113113
- email.generator.po 40 / 41 ( 97.0% translated).
114114
- email.header.po 4 / 40 ( 10.0% translated).
115115
- email.headerregistry.po 12 / 111 ( 10.0% translated).

stats.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"completion": "68.11%", "translated": 42225, "entries": 61994, "updated_at": "2025-06-03T23:39:30+00:00Z"}
1+
{"completion": "68.11%", "translated": 42226, "entries": 61994, "updated_at": "2025-06-04T23:39:22+00:00Z"}

0 commit comments

Comments
 (0)