Skip to content

Commit 1e7f087

Browse files
committed
traduccion capitulo 07
1 parent 9203536 commit 1e7f087

File tree

3 files changed

+48
-48
lines changed

3 files changed

+48
-48
lines changed

eBook/07.5.md

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
# 7.5 Files
1+
# 7.5 Archivos
22

3-
File is must-have object in every single computer device, and web applications also have many usage with files. In this section, we're going to learn how to operate files in Go.
3+
El archivo se debe-tener como un objeto unico en cada dispositivo informático y tambien en aplicaciones web se tiene mucho uso. En esta sección, vamos a aprender a manejar archivos en Go.
44

5-
## Directories
5+
## DirectoriosDirectories
66

7-
Most of functions of file operations is in package `os`, here are some functions about directories:
7+
La mayor parte de las funciones de las operaciones de archivos estan en el package `os`, he aquí algunas funciones sobre directorios:
88

99
- func Mkdir(name string, perm FileMode) error
1010

11-
Create directory with `name`, `perm` is permission, like 0777.
11+
Crear directorio con `name`, `perm`, 0777.
1212

1313
- func MkdirAll(path string, perm FileMode) error
1414

15-
Create multiple directories according to `path`, like `astaxie/test1/test2`.
15+
Crear varios directorios de acuerdo al `path`, como `astaxie/test1/test2`.
1616

1717
- func Remove(name string) error
1818

19-
Remove directory with `name`, it returns error if it's not directory or not empty.
19+
Remueve el directorio `name`, devuelve error si no es directorio o no está vacío.
2020

2121
- func RemoveAll(path string) error
2222

23-
Remove multiple directories according to `path`, it will not be deleted if `path` is a single path.
23+
Eliminar varios directorios de acuerdo `path` , no se borrará si camino es un camino único.
2424

25-
Code sample:
25+
Codigo de ejemplo:
2626

2727
package main
2828

@@ -41,46 +41,46 @@ Code sample:
4141
os.RemoveAll("astaxie")
4242
}
4343

44-
## Files
44+
## Archivos
4545

46-
### Create and open files
46+
### Crear y abrir archivos
4747

48-
Two functions to create files:
48+
Dos funciones para crear los archivos:
4949

5050
- func Create(name string) (file *File, err Error)
5151

52-
Create file with `name` and return a file object with permission 0666 and read-writable.
52+
Crear un archivo con el `name` y devolver un objeto de archivo con el permiso 0666 de lectura y escritura
5353

5454
- func NewFile(fd uintptr, name string) *File
5555

56-
Create file and return a file object.
56+
Crear un archivo y devolver un objeto de archivo.
5757

5858

59-
Two functions to open files:
59+
Dos funciones para abrir archivos:
6060

6161
- func Open(name string) (file *File, err Error)
6262

63-
Open file with `name` with read-only permission, it calls `OpenFile` underlying.
63+
Open file with `name` con el permiso de sólo lectura, y llama a `OpenFile` con guion bajo.
6464

6565
- func OpenFile(name string, flag int, perm uint32) (file *File, err Error)
6666

67-
Open file with `name`, `flag` is open mode like read-only, read-write, `perm` is permission.
67+
Open file with `name`, `flag` es el modo abierto como read-only, read-write, `perm` es el permiso.
6868

69-
### Write files
69+
### Escribir archivos
7070

71-
Functions for writing files:
71+
Funciones para la escritura de archivos:
7272

7373
- func (file *File) Write(b []byte) (n int, err Error)
7474

75-
Write byte type content to file.
75+
Escribe byte tipo de contenido en un archivo.
7676

7777
- func (file *File) WriteAt(b []byte, off int64) (n int, err Error)
7878

79-
Write byte type content to certain position of file.
79+
Escribe byte tipo de contenido a determinada posición de archivo.
8080

8181
- func (file *File) WriteString(s string) (ret int, err Error)
8282

83-
Write string to file.
83+
Escribe cadena en el archivo.
8484

8585
Code sample:
8686

@@ -105,17 +105,17 @@ Code sample:
105105
}
106106
}
107107

108-
### Read files
108+
### Leer los archivos
109109

110-
Functions for reading files:
110+
Funciones para leer los archivos
111111

112112
- func (file *File) Read(b []byte) (n int, err Error)
113113

114-
Read data to `b`.
114+
Lee datos de `b`.
115115

116116
- func (file *File) ReadAt(b []byte, off int64) (n int, err Error)
117117

118-
Read data from position `off` to `b`.
118+
Lee datos en posicion `off` to `b`.
119119

120120
Code sample:
121121

@@ -144,16 +144,16 @@ Code sample:
144144
}
145145
}
146146

147-
### Delete files
147+
### Eliminar archivos
148148

149-
Go uses same function for removing files and directories:
149+
Go utiliza la misma función para eliminar archivos y directorios:
150150

151151
- func Remove(name string) Error
152152

153-
Remove file or directory with `name`.( ***`name` ends with `/` means directory*** )
153+
Eliminar archivo o directorio con `name`.( ***`name`termina con `/` directorio*** )
154154

155155
## Links
156156

157157
- [Directory](preface.md)
158158
- Previous section: [Templates](07.4.md)
159-
- Next section: [Strings](07.6.md)
159+
- Next section: [Strings](07.6.md)

eBook/07.6.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# 7.6 Strings
1+
# 7.6 cadenas de texto
22

3-
Almost everything we see is represented by string, so it's a very important part of web development, including user inputs, database access; also we need to split, join and convert strings in many cases. In this section, we are going to introduce packages `strings` and `strconv` in Go standard library.
3+
Casi todo lo que vemos está representado por string, por lo que es una parte muy importante del desarrollo web, incluyendo las entradas de usuario, acceso a bases de datos; También tenemos que dividir, unir y convertir cadenas en muchos casos. En esta sección, vamos a introducir los paquetes `strings` and `strconv` en Go biblioteca estándar.
44

55
## strings
66

7-
Following functions are from package `strings`, more details please see official documentation:
7+
Las siguientes funciones son del package `strings`, más detalles, ver la documentación oficial:
88

99
- func Contains(s, substr string) bool
1010

11-
Check if string `s` contains string `substr`, returns boolean value.
11+
Compruebe si la cadena `s` contiene string `substr`, devuelve el valor booleano.
1212

1313
fmt.Println(strings.Contains("seafood", "foo"))
1414
fmt.Println(strings.Contains("seafood", "bar"))
@@ -22,15 +22,15 @@ Following functions are from package `strings`, more details please see official
2222

2323
- func Join(a []string, sep string) string
2424

25-
Combine strings from slice with separator `sep`.
25+
Combina strings de un slice con el separador `sep`.
2626

2727
s := []string{"foo", "bar", "baz"}
2828
fmt.Println(strings.Join(s, ", "))
2929
//Output:foo, bar, baz
3030
3131
- func Index(s, sep string) int
3232

33-
Find index of `sep` in string `s`, returns -1 if it's not found.
33+
Encuentra el index `sep` en el string `s`, retorna -1 si no lo encuentra.
3434

3535
fmt.Println(strings.Index("chicken", "ken"))
3636
fmt.Println(strings.Index("chicken", "dmr"))
@@ -39,14 +39,14 @@ Following functions are from package `strings`, more details please see official
3939

4040
- func Repeat(s string, count int) string
4141

42-
Repeat string `s` with `count` times.
42+
Repite el string `s` con `count` veces.
4343

4444
fmt.Println("ba" + strings.Repeat("na", 2))
4545
//Output:banana
4646

4747
- func Replace(s, old, new string, n int) string
4848

49-
Replace string `old` with string `new` in string `s`, `n` means replication times, if n less than 0 means replace all.
49+
Reemplaza el string `old` con el string `new` en el string `s`, `n` ignifica tiempos de replicación, si n es menor que 0 significa reemplazar todos.
5050

5151
fmt.Println(strings.Replace("oink oink oink", "k", "ky", 2))
5252
fmt.Println(strings.Replace("oink oink oink", "oink", "moo", -1))
@@ -55,7 +55,7 @@ Following functions are from package `strings`, more details please see official
5555

5656
- func Split(s, sep string) []string
5757

58-
Split string `s` with separator `sep` into a slice.
58+
Separar el string `s` con el separador `sep` en el slice.
5959

6060
fmt.Printf("%q\n", strings.Split("a,b,c", ","))
6161
fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a "))
@@ -68,22 +68,22 @@ Following functions are from package `strings`, more details please see official
6868

6969
- func Trim(s string, cutset string) string
7070

71-
Remove `cutset` of string `s` if it's leftmost or rightmost.
71+
Remueve `cutset` del string `s` si esta a la derecha o izquierda.
7272

7373
fmt.Printf("[%q]", strings.Trim(" !!! Achtung !!! ", "! "))
7474
Output:["Achtung"]
7575

7676
- func Fields(s string) []string
7777

78-
Remove space items and split string with space in to a slice.
78+
Remueve los espaciositems and split string with space in to a slice.
7979

8080
fmt.Printf("Fields are: %q", strings.Fields(" foo bar baz "))
8181
//Output:Fields are: ["foo" "bar" "baz"]
8282

8383

8484
## strconv
8585

86-
Following functions are from package `strconv`, more details please see official documentation:
86+
Las siguientes funciones son del package `strconv` , más detalles, consulte la documentación oficial:
8787

8888
- Append series convert data to string and append to current byte slice.
8989

@@ -103,7 +103,7 @@ Following functions are from package `strconv`, more details please see official
103103
fmt.Println(string(str))
104104
}
105105

106-
- Format series convert other type data to string.
106+
- Format series convertir otros datos de tipo de cadena.
107107

108108
package main
109109

@@ -121,7 +121,7 @@ Following functions are from package `strconv`, more details please see official
121121
fmt.Println(a, b, c, d, e)
122122
}
123123

124-
- Parse series convert string to other types.
124+
- Parse series convertir string a otros tipos.
125125

126126
package main
127127

@@ -158,4 +158,4 @@ Following functions are from package `strconv`, more details please see official
158158

159159
- [Directory](preface.md)
160160
- Previous section: [Files](07.5.md)
161-
- Next section: [Summary](07.7.md)
161+
- Next section: [Summary](07.7.md)

eBook/07.7.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# 7.7 Summary
1+
# 7.7 Resumen
22

3-
In this chapter, we introduced some text process tools like XML, JSON, Regexp and template. XML and JSON are data exchange tools, if you can represent almost all kinds of information though these two formats. Regexp is a powerful tool for searching, replacing, cutting text content. With template, you can easily combine dynamic data with static files. These tools are all useful when you develop web application, I hope you understand more about processing and showing content.
3+
En este capítulo, presentamos algunas herramientas de proceso de texto como XML, JSON, Regexp y plantilla. XML y JSON son herramientas de intercambio de datos, si se puede representar a casi todo tipo de información, aunque estos dos formatos. Regexp es una poderosa herramienta para buscar, reemplazar, cortar el contenido del texto. Con la plantilla, usted puede combinar fácilmente datos dinámicos con archivos estáticos. Estas herramientas son útiles cuando se desarrollan aplicaciones web, espero que entienda más sobre el procesamiento y la presentación de contenidos..
44

55
## Links
66

77
- [Directory](preface.md)
88
- Previous section: [Strings](07.6.md)
9-
- Next chapter: [Web services](08.0.md)
9+
- Next chapter: [Web services](08.0.md)

0 commit comments

Comments
 (0)