Skip to content

Commit fa33d45

Browse files
author
Victor Sosa
committed
CB-9444 cordova-plugin-file documentation translation: cordova-plugin-file
1 parent 0d605bd commit fa33d45

File tree

8 files changed

+270
-454
lines changed

8 files changed

+270
-454
lines changed

doc/de/plugins.md

Lines changed: 31 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -19,106 +19,83 @@
1919

2020
# Hinweise für Plugin-Entwickler
2121

22-
Diese Notizen sollen in erster Linie für Android und iOS-Entwickler, die Plugins welche Schnittstelle mit dem Dateisystem, mit dem Datei-Plugin schreiben möchten.
22+
Diese Notizen sind hauptsächlich für Android und iOS-Entwickler, die Plugins welche Schnittstelle mit dem Dateisystem, mit dem Plugin Datei schreiben möchten.
2323

2424
## Arbeiten mit Cordova-Datei-System-URLs
2525

26-
Seit der Version 1.0.0, wurde dieses Plugin URLs mit verwendet eine `cdvfile` Regelung für die gesamte Kommunikation über die Brücke, sondern als raw-Device Dateisystempfade zu JavaScript auszusetzen.
26+
Seit der Version 1.0.0, wurde dieses Plugin verwendet URLs mit einer `cdvfile` Regelung für die gesamte Kommunikation über die Brücke, sondern als raw-Device Dateisystempfade zu JavaScript auszusetzen.
2727

2828
Auf der Seite JavaScript bedeutet dies, dass FileEntries und DirectoryEntry-Objekt ein FullPath-Attribut haben, die relativ zum Stammverzeichnis des Dateisystems HTML ist. Wenn Ihr Plugins-JavaScript-API ein FileEntries oder DirectoryEntry-Objekt akzeptiert, rufen Sie `.toURL()` auf das Objekt vor der Übergabe an systemeigenen Code über die Brücke.
2929

3030
### Konvertieren von Cdvfile: / / URLs auf Fileystem Pfade
3131

32-
Plugins, die auf das Dateisystem schreiben müssen, möchten möglicherweise eine empfangene Datei-System-URL auf eine tatsächliche Stelle des Dateisystems zu konvertieren. Es gibt mehrere Wege, dies zu tun, je nach einheitlichen Plattform.
32+
Plugins, die auf das Dateisystem schreiben müssen, sollten eine empfangene Datei-System-URL auf eine tatsächliche Stelle des Dateisystems zu konvertieren. Es gibt mehrere Wege, dies zu tun, je nach einheitlichen Plattform.
3333

34-
Es ist wichtig zu erinnern, dass nicht alle `cdvfile://` URLs sind zuweisbaren real Dateien auf das Gerät. Einige URLs verweisen auf Vermögenswerte auf Gerät die werden nicht durch Dateien dargestellt, oder sogar auf Remoteressourcen verweisen kann. Aufgrund dieser Möglichkeiten sollten Plugins immer testen, ob sie ein sinnvolles Ergebnis zu erhalten, wieder beim URLs in Pfade umwandeln.
34+
Es ist wichtig, daran erinnern, dass nicht alle `cdvfile://` URLs sind zuweisbaren real Dateien auf das Gerät. Einige URLs verweisen auf Vermögenswerte auf Gerät nicht durch Dateien dargestellt werden, oder sogar auf Remoteressourcen verweisen können. Aufgrund dieser Möglichkeiten sollten Plugins immer testen, ob sie ein sinnvolles Ergebnis zu erhalten, wieder bei dem Versuch, die URLs in Pfade umwandeln.
3535

3636
#### Android
3737

38-
Auf Android, die einfachste Methode zum Konvertieren eines `cdvfile://` darin, dass die URL zu einem Dateisystempfad verwenden `org.apache.cordova.CordovaResourceApi` . `CordovaResourceApi`verfügt über mehrere Methoden der verarbeiten kann `cdvfile://` URLs:
38+
Auf Android, konvertiert die einfachste Methode eine `cdvfile://` URL zu einem Dateisystempfad zu verwenden ist `org.apache.cordova.CordovaResourceApi` . `CordovaResourceApi`verfügt über mehrere Methoden der verarbeiten kann `cdvfile://` URLs:
3939

40-
// webView is a member of the Plugin class
41-
CordovaResourceApi resourceApi = webView.getResourceApi();
40+
WebView ist Mitglied der Plugin-Klasse CordovaResourceApi ResourceApi = webView.getResourceApi();
4241

43-
// Obtain a file:/// URL representing this file on the device,
44-
// or the same URL unchanged if it cannot be mapped to a file
45-
Uri fileURL = resourceApi.remapUri(Uri.parse(cdvfileURL));
42+
Erhalten eine file:/// URL, diese Datei auf dem Gerät / / oder die gleiche URL unverändert, wenn es eine Datei-Uri FileURL zugeordnet werden kann nicht = resourceApi.remapUri(Uri.parse(cdvfileURL));
4643

4744

4845
Es ist auch möglich, das Plugin Datei direkt zu verwenden:
4946

50-
import org.apache.cordova.file.FileUtils;
51-
import org.apache.cordova.file.FileSystem;
52-
import java.net.MalformedURLException;
47+
Import org.apache.cordova.file.FileUtils;
48+
Import org.apache.cordova.file.FileSystem;
49+
Import Java.net.MalformedURLException:;
5350

54-
// Get the File plugin from the plugin manager
55-
FileUtils filePlugin = (FileUtils)webView.pluginManager.getPlugin("File");
51+
Erhalten Sie das Datei-Plugin aus dem Plugin-Manager FileUtils FilePlugin = (FileUtils)webView.pluginManager.getPlugin("File");
5652

57-
// Given a URL, get a path for it
58-
try {
59-
String path = filePlugin.filesystemPathForURL(cdvfileURL);
60-
} catch (MalformedURLException e) {
61-
// The filesystem url wasn't recognized
62-
}
53+
Angesichts eine URL, einen Pfad zu erhalten, denn es versuchen {String Pfad = filePlugin.filesystemPathForURL(cdvfileURL);} catch (MalformedURLException e) {/ / die Dateisystem-Url war nicht erkannt}
6354

6455

65-
Konvertieren von einen Pfad zu einer `cdvfile://` URL:
56+
Aus einem Pfad zu konvertieren eine `cdvfile://` URL:
6657

67-
import org.apache.cordova.file.LocalFilesystemURL;
58+
Import org.apache.cordova.file.LocalFilesystemURL;
6859

69-
// Get a LocalFilesystemURL object for a device path,
70-
// or null if it cannot be represented as a cdvfile URL.
71-
LocalFilesystemURL url = filePlugin.filesystemURLforLocalPath(path);
72-
// Get the string representation of the URL object
73-
String cdvfileURL = url.toString();
60+
Rufen Sie ein LocalFilesystemURL-Objekt für einen Gerätepfad / / oder null, wenn sie nicht als URL Cdvfile dargestellt wird.
61+
LocalFilesystemURL Url = filePlugin.filesystemURLforLocalPath(path);
62+
Erhalten Sie die Zeichenfolgendarstellung der URL Objekt String CdvfileURL = url.toString();
7463

7564

7665
Wenn Ihr Plugin eine Datei erstellt, und Sie dafür ein FileEntries-Objekt zurückgeben möchten, verwenden Sie das Datei-Plugin:
7766

78-
// Return a JSON structure suitable for returning to JavaScript,
79-
// or null if this file is not representable as a cdvfile URL.
80-
JSONObject entry = filePlugin.getEntryForFile(file);
67+
Zurückgeben eine JSON-Struktur geeignet für die Rückgabe an JavaScript, / / oder null, wenn diese Datei nicht als URL Cdvfile darstellbar ist.
68+
JSONObject Eintrag = filePlugin.getEntryForFile(file);
8169

8270

8371
#### iOS
8472

8573
Cordova auf iOS verwendet nicht das gleiche `CordovaResourceApi` Konzept als Android. Auf iOS sollten Sie das Datei-Plugin verwenden, zum Konvertieren von URLs und Dateisystem-Pfaden.
8674

87-
// Get a CDVFilesystem URL object from a URL string
88-
CDVFilesystemURL* url = [CDVFilesystemURL fileSystemURLWithString:cdvfileURL];
89-
// Get a path for the URL object, or nil if it cannot be mapped to a file
90-
NSString* path = [filePlugin filesystemPathForURL:url];
75+
Rufen Sie ein CDVFilesystem URL-Objekt von einer URL-Zeichenfolge CDVFilesystemURL * Url = [CDVFilesystemURL FileSystemURLWithString:cdvfileURL];
76+
Erhalten Sie einen Pfad für die URL-Objekt oder NULL, wenn es einen Dateipfad NSString * zugeordnet werden kann nicht = [FilePlugin FilesystemPathForURL:url];
9177

9278

93-
// Get a CDVFilesystem URL object for a device path, or
94-
// nil if it cannot be represented as a cdvfile URL.
95-
CDVFilesystemURL* url = [filePlugin fileSystemURLforLocalPath:path];
96-
// Get the string representation of the URL object
97-
NSString* cdvfileURL = [url absoluteString];
79+
Eine CDVFilesystem URL-Objekt für einen Gerätepfad abrufen oder / / gleich NULL, wenn sie nicht als URL Cdvfile dargestellt wird.
80+
CDVFilesystemURL-Url = [FilePlugin FileSystemURLforLocalPath:path];
81+
Erhalten Sie die Zeichenfolgendarstellung der URL Objekt NSString * CdvfileURL = [Url AbsoluteString];
9882

9983

10084
Wenn Ihr Plugin eine Datei erstellt, und Sie dafür ein FileEntries-Objekt zurückgeben möchten, verwenden Sie das Datei-Plugin:
10185

102-
// Get a CDVFilesystem URL object for a device path, or
103-
// nil if it cannot be represented as a cdvfile URL.
104-
CDVFilesystemURL* url = [filePlugin fileSystemURLforLocalPath:path];
105-
// Get a structure to return to JavaScript
106-
NSDictionary* entry = [filePlugin makeEntryForLocalURL:url]
86+
Eine CDVFilesystem URL-Objekt für einen Gerätepfad abrufen oder / / gleich NULL, wenn sie nicht als URL Cdvfile dargestellt wird.
87+
CDVFilesystemURL-Url = [FilePlugin FileSystemURLforLocalPath:path];
88+
Erhalten eine Struktur zurück nach JavaScript NSDictionary * Eintrag = [FilePlugin MakeEntryForLocalURL:url]
10789

10890

10991
#### JavaScript
11092

11193
In JavaScript, bekommen eine `cdvfile://` URL aus einem FileEntries oder DirectoryEntry-Objekt, rufen Sie einfach `.toURL()` drauf:
11294

113-
var cdvfileURL = entry.toURL();
95+
Var CdvfileURL = entry.toURL();
11496

11597

116-
Im Plugin Antwort Handler um aus einer zurückgegebenen FileEntries-Struktur in ein tatsächliches Entry-Objekt zu konvertieren sollte Handlercode importieren die Datei-Erweiterung und ein neues Objekt erstellen:
98+
Im Plugin Antwort Handler zur Konvertierung von einer zurückgegebenen FileEntries-Struktur in einem tatsächlichen Eintrag-Objekt sollte Handlercode importieren die Datei-Erweiterung und ein neues Objekt zu erstellen:
11799

118-
// create appropriate Entry object
119-
var entry;
120-
if (entryStruct.isDirectory) {
121-
entry = new DirectoryEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
122-
} else {
123-
entry = new FileEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
124-
}
100+
Erstellen Sie entsprechenden Eintrag Objekt Var Eintrag;
101+
Wenn (entryStruct.isDirectory) {Eintrag = neues DirectoryEntry (entryStruct.name, entryStruct.fullPath, neue FileSystem(entryStruct.filesystemName));} sonst {Eintrag = neue FileEntries (entryStruct.name, entryStruct.fullPath, neue FileSystem(entryStruct.filesystemName));}

doc/es/plugins.md

Lines changed: 37 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -17,108 +17,85 @@
1717
under the License.
1818
-->
1919

20-
# Notas para los desarrolladores de plugin
20+
# Notas para los desarrolladores del plugin
2121

22-
Estas notas están pensadas principalmente para los desarrolladores de Android y el iOS que quieran escribir plugins que interfaz con el sistema de archivos usando el plugin de archivo.
22+
Estas notas están pensadas principalmente para desarrolladores de Android y el iOS que quieran escribir plugins que interfaz con el sistema de ficheros usando el plugin del archivo.
2323

24-
## Trabajando con Cordova archivo sistema URLs
24+
## Trabajar con URLs de sistema de archivo de Córdoba
2525

26-
Desde la versión 1.0.0, este plugin utiliza las direcciones URL con un `cdvfile` plan para todas las comunicaciones sobre el puente, en lugar de exponer rutas de sistema de archivo de dispositivo raw a JavaScript.
26+
Desde la versión 1.0.0, este plugin ha utilizado las direcciones URL con un `cdvfile` plan para todas las comunicaciones sobre el puente, en lugar de exponer rutas de sistema de archivos de dispositivos raw para JavaScript.
2727

28-
En el lado de JavaScript, esto significa que los objetos FileEntry y DirectoryEntry tienen un atributo fullPath que es relativo a la raíz del sistema de archivos HTML. Si JavaScript API del plugin acepta un objeto FileEntry o DirectoryEntry, debe llamar a `.toURL()` en ese objeto antes de pasarla a través del puente a código nativo.
28+
En el lado de JavaScript, esto significa que los objetos FileEntry y DirectoryEntry tienen un atributo fullPath que es relativo a la raíz del sistema de archivos HTML. Si JavaScript API de tu plugin acepta un objeto FileEntry o DirectoryEntry, usted debe llamar a `.toURL()` en ese objeto antes de pasar a través del puente al código nativo.
2929

3030
### Conversión de cdvfile: / / URL al fileystem caminos
3131

32-
Plugins que necesita escribir en el sistema de archivos puede querer convertir un archivo recibido sistema URL a una ubicación de archivos reales. Hay varias formas de hacer esto, dependiendo de la plataforma nativa.
32+
Plugins que necesita escribir en el sistema de archivos puede convertir un archivo recibido sistema URL a una ubicación de sistema de archivos real. Hay varias formas de hacerlo, dependiendo de la plataforma nativa.
3333

34-
Es importante recordar que no todos `cdvfile://` URLs son asignables a los archivos reales en el dispositivo. Algunas URLs pueden referirse a activos en dispositivos que no están representados por los archivos, o incluso pueden referirse a recursos remotos. Debido a estas posibilidades, plugins siempre debe probar si consiguen un resultado significativo cuando tratando de convertir URLs en trazados.
34+
Es importante recordar que no todos `cdvfile://` las direcciones URL son asignables a reales archivos en el dispositivo. Algunas URLs pueden referirse a activos en dispositivos que no están representadas por archivos, o incluso pueden hacer referencia a recursos remotos. Debido a estas posibilidades, plugins siempre debe comprobar si consiguen un resultado significativo cuando tratando de convertir las URL en trazados.
3535

3636
#### Android
3737

38-
En Android, el método más sencillo para convertir un `cdvfile://` URL a una ruta de sistema de archivos es utilizar `org.apache.cordova.CordovaResourceApi` . `CordovaResourceApi`tiene varios métodos que pueden manejar `cdvfile://` URLs:
38+
En Android, el método más simple para convertir un `cdvfile://` URL a una ruta de sistema de archivos es utilizar `org.apache.cordova.CordovaResourceApi` . `CordovaResourceApi`tiene varios métodos que pueden manejar `cdvfile://` URL:
3939

40-
// webView is a member of the Plugin class
41-
CordovaResourceApi resourceApi = webView.getResourceApi();
40+
webView es un miembro de la clase Plugin CordovaResourceApi resourceApi = webView.getResourceApi();
4241

43-
// Obtain a file:/// URL representing this file on the device,
44-
// or the same URL unchanged if it cannot be mapped to a file
45-
Uri fileURL = resourceApi.remapUri(Uri.parse(cdvfileURL));
42+
Obtener una URL file:/// representando este archivo en el dispositivo, / / o el mismo URL sin cambios si no se puede asignar a un archivo Uri fileURL = resourceApi.remapUri(Uri.parse(cdvfileURL));
4643

4744

48-
También es posible utilizar directamente el archivo plugin:
45+
También es posible utilizar el plugin de archivos directamente:
4946

50-
import org.apache.cordova.file.FileUtils;
51-
import org.apache.cordova.file.FileSystem;
52-
import java.net.MalformedURLException;
47+
Import org.apache.cordova.file.FileUtils;
48+
Import org.apache.cordova.file.FileSystem;
49+
Import java.net.MalformedURLException;
5350

54-
// Get the File plugin from the plugin manager
55-
FileUtils filePlugin = (FileUtils)webView.pluginManager.getPlugin("File");
51+
Obtener el archivo plugin desde el administrador de plugin FileUtils filePlugin = (FileUtils)webView.pluginManager.getPlugin("File");
5652

57-
// Given a URL, get a path for it
58-
try {
59-
String path = filePlugin.filesystemPathForURL(cdvfileURL);
60-
} catch (MalformedURLException e) {
61-
// The filesystem url wasn't recognized
62-
}
53+
Dada una URL, haz un camino para tratar de {camino de cadena = filePlugin.filesystemPathForURL(cdvfileURL);} catch (DD e) {/ / el sistema de archivos url no reconocida}
6354

6455

65-
Para convertir de un camino hacia un `cdvfile://` URL:
56+
Para convertir de una ruta a un `cdvfile://` URL:
6657

67-
import org.apache.cordova.file.LocalFilesystemURL;
58+
Import org.apache.cordova.file.LocalFilesystemURL;
6859

69-
// Get a LocalFilesystemURL object for a device path,
70-
// or null if it cannot be represented as a cdvfile URL.
60+
Obtener un objeto LocalFilesystemURL para una ruta, / / o null si no se puede representar como una dirección URL cdvfile.
7161
LocalFilesystemURL url = filePlugin.filesystemURLforLocalPath(path);
72-
// Get the string representation of the URL object
73-
String cdvfileURL = url.toString();
62+
Obtener la representación string de la URL objeto String cdvfileURL = url.toString();
7463

7564

76-
Si tu plugin crea un archivo y desea devolver un objeto FileEntry para ello, utilice el archivo plugin:
65+
Si tu plugin crea un archivo y desea devolver un objeto FileEntry para él, usar el plugin de archivos:
7766

78-
// Return a JSON structure suitable for returning to JavaScript,
79-
// or null if this file is not representable as a cdvfile URL.
80-
JSONObject entry = filePlugin.getEntryForFile(file);
67+
Devolver una estructura JSON adecuado para volver a JavaScript, / / o null si este archivo no es representable como una dirección URL cdvfile.
68+
JSONObject entrada = filePlugin.getEntryForFile(file);
8169

8270

8371
#### iOS
8472

85-
Cordova en iOS no utiliza el mismo `CordovaResourceApi` concepto como Android. En iOS, utilice el archivo plugin para convertir las direcciones URL y rutas de archivos.
73+
Cordova en iOS no utiliza la misma `CordovaResourceApi` concepto como Android. En iOS, debe usar el archivo plugin para convertir las direcciones URL y rutas de sistema de archivos.
8674

87-
// Get a CDVFilesystem URL object from a URL string
88-
CDVFilesystemURL* url = [CDVFilesystemURL fileSystemURLWithString:cdvfileURL];
89-
// Get a path for the URL object, or nil if it cannot be mapped to a file
90-
NSString* path = [filePlugin filesystemPathForURL:url];
75+
Obtener un objeto URL CDVFilesystem de una URL string CDVFilesystemURL * url = [CDVFilesystemURL fileSystemURLWithString:cdvfileURL];
76+
Obtener una ruta de acceso para el objeto URL, o nil si no puede ser asignado a una ruta de archivo NSString * = [filePlugin filesystemPathForURL:url];
9177

9278

93-
// Get a CDVFilesystem URL object for a device path, or
94-
// nil if it cannot be represented as a cdvfile URL.
95-
CDVFilesystemURL* url = [filePlugin fileSystemURLforLocalPath:path];
96-
// Get the string representation of the URL object
97-
NSString* cdvfileURL = [url absoluteString];
79+
Obtener un objeto URL CDVFilesystem para una ruta, o / / nula si no se puede representar como una dirección URL cdvfile.
80+
CDVFilesystemURL * url = [filePlugin fileSystemURLforLocalPath:path];
81+
Obtener la representación string de la URL objetos NSString * cdvfileURL = [enlace absoluteString];
9882

9983

100-
Si tu plugin crea un archivo y desea devolver un objeto FileEntry para ello, utilice el archivo plugin:
84+
Si tu plugin crea un archivo y desea devolver un objeto FileEntry para él, usar el plugin de archivos:
10185

102-
// Get a CDVFilesystem URL object for a device path, or
103-
// nil if it cannot be represented as a cdvfile URL.
104-
CDVFilesystemURL* url = [filePlugin fileSystemURLforLocalPath:path];
105-
// Get a structure to return to JavaScript
106-
NSDictionary* entry = [filePlugin makeEntryForLocalURL:url]
86+
Obtener un objeto URL CDVFilesystem para una ruta, o / / nula si no se puede representar como una dirección URL cdvfile.
87+
CDVFilesystemURL * url = [filePlugin fileSystemURLforLocalPath:path];
88+
Conseguir una estructura para volver a JavaScript NSDictionary * entrada = [filePlugin makeEntryForLocalURL:url]
10789

10890

10991
#### JavaScript
11092

111-
En JavaScript, para conseguir un `cdvfile://` URL de un objeto FileEntry o DirectoryEntry, simplemente llame a `.toURL()` en él:
93+
En JavaScript, para obtener un `cdvfile://` dirección URL de un objeto FileEntry o DirectoryEntry, simplemente llame al `.toURL()` en él:
11294

11395
var cdvfileURL = entry.toURL();
11496

11597

116-
En plugin manipuladores de respuesta, para convertir de una estructura FileEntry devuelta a un objeto real de la entrada, el código del controlador debe importar el archivo plugin y crear un nuevo objeto:
98+
En manipuladores de la respuesta del plugin, para convertir de una estructura FileEntry devuelta a un objeto real de la entrada, su código de controlador debe importar el archivo plugin y crear un nuevo objeto:
11799

118-
// create appropriate Entry object
119-
var entry;
120-
if (entryStruct.isDirectory) {
121-
entry = new DirectoryEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
122-
} else {
123-
entry = new FileEntry(entryStruct.name, entryStruct.fullPath, new FileSystem(entryStruct.filesystemName));
124-
}
100+
crear apropiado objeto var ingreso;
101+
Si (entryStruct.isDirectory) {entrada = new DirectoryEntry (entryStruct.name, entryStruct.fullPath, FileSystem(entryStruct.filesystemName)) nuevo;} else {entrada = nuevo FileEntry (entryStruct.name, entryStruct.fullPath, nuevo FileSystem(entryStruct.filesystemName));}

0 commit comments

Comments
 (0)