Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5ae469c

Browse files
authored
Merge pull request#63 from PyCampES/memory-translation
Memory translation
2 parentse244025 +a67ca1f commit5ae469c

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

‎.overrides/translation-memory.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
=======================
2+
Memoria de traducción
3+
=======================
4+
5+
6+
Esta página contiene la Memoria de Traducción, con todos los términos que hemos ido teniendo dudas,
7+
y coordinamos cuál era la mejor traducción dado el contexto.
8+
9+
Si quieres ver cómo se ha utilizado un término anteriormente, puedes utilizar la herramienta
10+
``find_in_po.py`` que muestra dónde se usó ese término: original y traducción lado a lado:
11+
12+
..code-block::text
13+
14+
$ python scripts/find_in_po.py docstring
15+
╒════════════════════════════════════════════════════════════════════════════════════════════════╤═══════════════════════════════════════════════════════════════════════════════════════════════╕
16+
│ The first statement of the function body can optionally be a string literal; this string │ La primera sentencia del cuerpo de la función puede ser opcionalmente una cadena de texto │
17+
│ literal is the function's documentation string, or :dfn:`docstring`. (More about docstrings │ literal; esta es la cadena de texto de documentación de la función, o :dfn:`docstring`. │
18+
│ can be found in the section :ref:`tut-docstrings`.) There are tools which use docstrings to │ (Puedes encontrar más acerca de docstrings en la sección :ref:`tut-docstrings`.). Existen │
19+
│ automatically produce online or printed documentation, or to let the user interactively browse │ herramientas que usan las ``docstrings`` para producir documentación imprimible o disponible │
20+
│ through code; it's good practice to include docstrings in code that you write, so make a habit │ en línea, o para dejar que los usuarios busquen interactivamente a través del código; es una │
21+
│ of it. │ buena práctica incluir ``docstrings`` en el código que escribes, y hacerlo un buen hábito. │
22+
├────────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤
23+
│ Here is an example of a multi-line docstring:: │ Este es un ejemplo de un ``docstring`` multi-línea:: │
24+
├────────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤
25+
│ Use docstrings. │ Usar ``docstrings``. │
26+
├────────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────┤
27+
28+
29+
Éstos son las palabras que hemos coordinado hasta el momento:
30+
31+
32+
loop
33+
Bucle. ``tutorial/controlflow.po``
34+
35+
handle exception
36+
Gestionar excepción. ``tutorial/inputoutput.po``
37+
38+
docstring
39+
docstring. ``library/idle.po``

‎scripts/find_in_po.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env python3
2+
3+
importargparse
4+
fromglobimportglob
5+
importos
6+
fromtextwrapimportfill
7+
8+
importregex
9+
importpolib
10+
fromtabulateimporttabulate
11+
12+
13+
deffind_in_po(pattern):
14+
table= []
15+
try:
16+
_,columns=os.popen("stty size","r").read().split()
17+
available_width=int(columns)//2-3
18+
except:
19+
available_width=80//2-3
20+
21+
forfileinglob("**/*.po"):
22+
pofile=polib.pofile(file)
23+
forentryinpofile:
24+
ifentry.msgstrandregex.search(pattern,entry.msgid):
25+
table.append(
26+
[
27+
fill(entry.msgid,width=available_width),
28+
fill(entry.msgstr,width=available_width),
29+
]
30+
)
31+
print(tabulate(table,tablefmt="fancy_grid"))
32+
33+
34+
defparse_args():
35+
parser=argparse.ArgumentParser(description="Find translated words.")
36+
parser.add_argument("pattern")
37+
returnparser.parse_args()
38+
39+
40+
defmain():
41+
args=parse_args()
42+
find_in_po(args.pattern)
43+
44+
45+
if__name__=="__main__":
46+
main()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp