Spaces:
Sleeping
Sleeping
| # Spanish (Español) - Python Quick Reference | |
|  | |
|  | |
|  | |
| > Write Python code in Spanish. This guide shows the Spanish keywords | |
| > to use for Legesher to understand your code. | |
| ## Language Details | |
| | Attribute | Value | | |
| | --------- | ----- | | |
| | **Language** | Spanish | | |
| | **Native Name** | Español | | |
| | **Script** | Latin | | |
| | **ISO 639-1** | `es` | | |
| | **ISO 639-2** | `spa` | | |
| | **BCP 47 Tag** | `es` | | |
| | **Text Direction** | Left-to-Right (LTR) | | |
| | **Status** | Experimental | | |
| ## Keywords (39 terms) | |
| These are Python's reserved words translated to Spanish. | |
| | English | Spanish | | |
| | ------- | ------ | | |
| | `and` | `y` | | |
| | `as` | `como` | | |
| | `assert` | `afirmar` | | |
| | `async` | `asincrónico` | | |
| | `await` | `esperar` | | |
| | `break` | `romper` | | |
| | `case` | `caso` | | |
| | `class` | `clase` | | |
| | `continue` | `continuar` | | |
| | `def` | `definir` | | |
| | `del` | `eliminar` | | |
| | `elif` | `si_no` | | |
| | `else` | `sino` | | |
| | `except` | `excepto` | | |
| | `except*` | `excepto*` | | |
| | `False` | `falso` | | |
| | `finally` | `finalmente` | | |
| | `for` | `por` | | |
| | `from` | `desde` | | |
| | `global` | `declara_variable_global` | | |
| | `if` | `si` | | |
| | `import` | `importar` | | |
| | `in` | `en` | | |
| | `is` | `ser` | | |
| | `lambda` | `funcion_anonima` | | |
| | `match` | `coincidir` | | |
| | `None` | `nulo` | | |
| | `nonlocal` | `nolocal` | | |
| | `not` | `no` | | |
| | `or` | `o` | | |
| | `pass` | `pasar` | | |
| | `raise` | `levantar` | | |
| | `return` | `devolver` | | |
| | `True` | `verdadero` | | |
| | `try` | `probar` | | |
| | `type` | `tipo` | | |
| | `while` | `mientras` | | |
| | `with` | `con` | | |
| | `yield` | `dar` | | |
| ## Built-in Functions (72 terms) | |
| Python's built-in functions and types in Spanish. | |
| | English | Spanish | | |
| | ------- | ------ | | |
| | `abs` | `valorabsoluto` | | |
| | `aiter` | `iterador_asincrónico` | | |
| | `all` | `todo` | | |
| | `anext` | `próximo` | | |
| | `any` | `cualquier` | | |
| | `ascii` | `asciiificar` | | |
| | `bin` | `binario` | | |
| | `bool` | `booleano` | | |
| | `breakpoint` | `puntodeinterrupción` | | |
| | `bytearray` | `conjuntoDeBytes` | | |
| | `bytes` | `bytes_inmutables` | | |
| | `callable` | `llamable` | | |
| | `chr` | `carácter` | | |
| | `classmethod` | `métododeclase` | | |
| | `compile` | `compilar` | | |
| | `complex` | `complejo` | | |
| | `delattr` | `eliminar_atributo` | | |
| | `dict` | `diccionario` | | |
| | `dir` | `directorio` | | |
| | `divmod` | `division_con_resta` | | |
| | `ellipsis` | `elipsis` | | |
| | `enumerate` | `elenumerar` | | |
| | `eval` | `evalúo` | | |
| | `exec` | `ejecutar` | | |
| | `filter` | `filtrar` | | |
| | `float` | `flotante` | | |
| | `format` | `formatear` | | |
| | `frozenset` | `conjuntocongelado` | | |
| | `getattr` | `obtenerelatributo` | | |
| | `globals` | `globales` | | |
| | `hasattr` | `teneratributo` | | |
| | `hash` | `resumen_hash` | | |
| | `help` | `ayuda` | | |
| | `hex` | `hexadecimal` | | |
| | `id` | `identificador` | | |
| | `input` | `entrada` | | |
| | `int` | `entero` | | |
| | `isinstance` | `ser_de_la_clase` | | |
| | `issubclass` | `subclasede` | | |
| | `iter` | `iterar` | | |
| | `len` | `longitud` | | |
| | `list` | `lista` | | |
| | `locals` | `loslocales` | | |
| | `map` | `mapear` | | |
| | `max` | `máximo` | | |
| | `memoryview` | `vistadememoria` | | |
| | `min` | `minimo` | | |
| | `next` | `siguiente` | | |
| | `notimplemented` | `noimplementado` | | |
| | `object` | `objeto` | | |
| | `oct` | `octal` | | |
| | `open` | `abrir` | | |
| | `ord` | `ordinal` | | |
| | `pow` | `potencia` | | |
| | `print` | `imprimir` | | |
| | `property` | `propiedad` | | |
| | `range` | `rango` | | |
| | `repr` | `representación` | | |
| | `reversed` | `revesado` | | |
| | `round` | `redondear` | | |
| | `set` | `conjunto` | | |
| | `setattr` | `asignar` | | |
| | `slice` | `rebanada` | | |
| | `sorted` | `ordenado` | | |
| | `staticmethod` | `estático` | | |
| | `str` | `cadena` | | |
| | `sum` | `sumar` | | |
| | `super` | `superClase` | | |
| | `tuple` | `tupla` | | |
| | `type` | `tipo` | | |
| | `vars` | `variables` | | |
| | `zip` | `acopiar` | | |
| ## Exceptions (69 terms) | |
| Exception classes for error handling. | |
| | English | Spanish | | |
| | ------- | ------ | | |
| | `arithmeticerror` | `erroraritmético` | | |
| | `assertionerror` | `errordeaserción` | | |
| | `attributeerror` | `Errordeatributo` | | |
| | `baseexception` | `excepciónbase` | | |
| | `baseexceptiongroup` | `grupodeexcepcionesbase` | | |
| | `basegeneratorexit` | `generarsalida` | | |
| | `blockingioerror` | `errordeESbloqueante` | | |
| | `brokenpipeerror` | `errordetuberíarota` | | |
| | `buffererror` | `errordebúfer` | | |
| | `byteswarning` | `advertenciadebytes` | | |
| | `childprocesserror` | `errordeprocesosecundario` | | |
| | `connectionabortederror` | `errordeabortarconexión` | | |
| | `connectionerror` | `errordeconexión` | | |
| | `connectionrefusederror` | `errorderechazodeconexión` | | |
| | `connectionreseterror` | `resetearconexión` | | |
| | `deprecationwarning` | `advertenciadedepreciación` | | |
| | `encodingwarning` | `advertenciadecodificación` | | |
| | `environmenterror` | `errordeentorno` | | |
| | `eoferror` | `errordeentradasalida` | | |
| | `exception` | `excepción` | | |
| | `exceptiongroup` | `grupodeexcepciones` | | |
| | `fileexistserror` | `errordeexistenciadearchivo` | | |
| | `filenotfounderror` | `Errordenoencontrarelarchivo` | | |
| | `floatingpointerror` | `errordepunteroflotante` | | |
| | `futurewarning` | `advertenciafutura` | | |
| | `generatorexit` | `salidadegenerador` | | |
| | `importerror` | `errordeimportación` | | |
| | `importwarning` | `advertenciadeimportación` | | |
| | `indentationerror` | `errordesangría` | | |
| | `indexerror` | `Errordeíndice` | | |
| | `interruptederror` | `errordeinterrupción` | | |
| | `ioerror` | `errordeES` | | |
| | `isadirectoryerror` | `errordedirectorio` | | |
| | `keyboardinterrupt` | `interrupcióndelteclado` | | |
| | `keyerror` | `errordeclave` | | |
| | `lookuperror` | `errordebúsqueda` | | |
| | `memoryerror` | `errordememoria` | | |
| | `modulenotfounderror` | `Errordemódulonoencontrado` | | |
| | `nameerror` | `Errordenombre` | | |
| | `notadirectoryerror` | `errordenoserundirectorio` | | |
| | `notimplementederror` | `errordenoimplementación` | | |
| | `oserror` | `ErrorDeOS` | | |
| | `overflowerror` | `errordedesbordamiento` | | |
| | `pendingdeprecationwarning` | `advertenciadeadvertenciadedepreciaciónpendiente` | | |
| | `permissionerror` | `errordepermiso` | | |
| | `processlookuperror` | `errordebúsquedadeproceso` | | |
| | `recursionerror` | `errorderecursión` | | |
| | `referenceerror` | `errordereferencia` | | |
| | `resourcewarning` | `advertenciaderecursos` | | |
| | `runtimeerror` | `errorentiempodeejecución` | | |
| | `runtimewarning` | `advertenciadetiempodeejecución` | | |
| | `stopasynciteration` | `detenerlaiteraciónasincrónica` | | |
| | `stopiteration` | `detener_iteración` | | |
| | `syntaxerror` | `errordesintaxis` | | |
| | `syntaxwarning` | `advertenciadesintaxis` | | |
| | `systemexit` | `salirdelsistema` | | |
| | `taberror` | `errordetabulación` | | |
| | `timeouterror` | `errordetiempodeespera` | | |
| | `typeerror` | `errordetipo` | | |
| | `unboundlocalerror` | `errordereferencialocalnoenlazada` | | |
| | `unicodedecodeerror` | `errordedecodificacióndeUnicode` | | |
| | `unicodeencodeerror` | `errordecodificaciónunicode` | | |
| | `unicodeerror` | `errordeunicode` | | |
| | `unicodetranslateerror` | `errordetraduccióndeUnicode` | | |
| | `unicodewarning` | `advertenciadeunicode` | | |
| | `userwarning` | `advertenciadelusuario` | | |
| | `valueerror` | `errordevalor` | | |
| | `warning` | `advertencia` | | |
| | `zerodivisionerror` | `errordedivisiónporcero` | | |
| ## Example Code | |
| Here's an example showing Spanish Python code with Legesher: | |
| ```python | |
| # Ejemplo: Función factorial con manejo de errores | |
| desde typing importar Optional | |
| definir factorial(n): | |
| """Calcular el factorial de n.""" | |
| si n < 0: | |
| levantar Errordevalor("Los números negativos no están permitidos") | |
| si_no n == 0 o n == 1: | |
| devolver 1 | |
| sino: | |
| devolver n * factorial(n - 1) | |
| definir principal(): | |
| numeros = [entero(x) por x en rango(6)] | |
| por numero en numeros: | |
| resultado = factorial(numero) | |
| imprimir(f"{numero}! = {resultado}") | |
| # Demostrar bucle while | |
| contador = 0 | |
| mientras contador < 3: | |
| imprimir(f"Contador: {contador}") | |
| contador += 1 | |
| # Demostrar try/except | |
| probar: | |
| factorial(-1) | |
| excepto Errordevalor como error: | |
| imprimir(f"Error: {error}") | |
| finalmente: | |
| imprimir("¡Listo!") | |
| si __name__ == "__main__": | |
| principal() | |
| ``` | |
| ## Usage | |
| ```python | |
| from legesher_i18n import LanguagePackLoader | |
| # Load Spanish pack for Python 3.12 | |
| loader = LanguagePackLoader() | |
| pack = loader.load("es", "python", "3.12") | |
| # Translate code | |
| from legesher import translate | |
| english_code = translate(your_es_code, from_lang="es", to_lang="en") | |
| ``` | |
| ## Contributing | |
| Found a better translation? We welcome contributions from native speakers! | |
| 1. Edit `legesher_i18n_python_es/packs/<version>.yml` for the Python version where the term was introduced: | |
| - `3.10.yml` - Base translations (most terms) | |
| - `3.11.yml` - Terms added in Python 3.11 (e.g., `except*`) | |
| - `3.12.yml` - Terms added in Python 3.12 (e.g., `type`) | |
| - `3.13.yml` / `3.14.yml` - Future additions | |
| 2. Submit a pull request with your reasoning | |
| 3. Translations should be natural, commonly used in CS education, and easy to type | |