Localization in JQuery PDF Viewer
15 Jan 202124 minutes to read
The text labels provided in the ejPdfViewer control can be localized using the collection of localized strings using ej.PdfViewer.Locale for different cultures. By default, ejPdfViewer is localized in “en-US” culture.
The different locale value for the ejPdfViewer control can be specified using the locale property.
<div id="viewer"></div>
<script type="text/javascript">
$(function () {
$("#viewer").ejPdfViewer({ serviceUrl: '../api/PdfViewer', locale:"fr-FR" });
});
</script>
Following table shows the default values for the components in the ejPdfViewer widget in ‘en-US’ culture
Component |
Function |
Keywords |
Values |
toolbar | first | headerText | First |
contentText | Go to the first page of the PDF document. | ||
previous | headerText | Previous | |
contentText | Go to the previous page of the PDF document. | ||
next | headerText | Next | |
contentText | Go to the next page of the PDF document. | ||
last | headerText | Last | |
contentText | Go to the last page of the PDF document. | ||
zoomIn | headerText | Zoom-In | |
contentText | Zoom in to the PDF document. | ||
zoomOut | headerText | Zoom-Out | |
contentText | Zoom out of the PDF document. | ||
pageIndex | headerText | Page Number | |
contentText | Current page number in view. | ||
zoom | headerText | Zoom | |
contentText | Zoom in or out of the PDF document. | ||
fitToWidth | headerText | Fit to Width | |
contentText | Fit the PDF page to the width of the container. | ||
fitToPage | headerText | Fit to Page | |
contentText | Fit the PDF page to the container. | ||
headerText | |||
contentText | Print the PDF document. | ||
download | headerText | Download | |
contentText | Download the PDF document. | ||
search | headerText | Search Text | |
contentText | Search text in the PDF pages. | ||
highlight | headerText | Highlight Text | |
contentText | Highlight text in the PDF pages. | ||
strikeout | headerText | Strikethrough Text | |
contentText | Strikethrough text in the PDF pages. | ||
underline | headerText | Underline Text | |
contentText | Underline text in the PDF pages. | ||
signature | headerText | Signature | |
contentText | Add or create the hand-written signature. | ||
select | headerText | Selection | |
contentText | Selection tool for text. | ||
scroll | headerText | Panning | |
contentText | Click to pan around the document. | ||
contextMenu | copy | contentText | Copy |
googleSearch | contentText | Search Google | |
openPopup | contentText | Open Pop-Up Note | |
Delete | contentText | Delete | |
properties | contentText | Properties | |
Find | contentText | Find | |
matchCase | contentText | Match Case | |
auto | contentText | Auto | |
propertyWindow | underlineProperties | contentText | Underline Properties |
strikeOutProperties | contentText | StrikeOut Properties | |
highlightProperties | contentText | Highlight Properties | |
signatureProperties | contentText | Signature Properties | |
appearance | contentText | Appearance | |
general | contentText | General | |
color | contentText | Color | |
opacity | contentText | Opacity | |
author | contentText | Author | |
subject | contentText | Subject | |
modified | contentText | Modified | |
ok | contentText | OK | |
cancel | contentText | Cancel | |
locked | contentText | Locked | |
signatureWindow | Signature | contentText | Add Signature |
Add | contentText | Add | |
clear | contentText | Clear | |
waitingPopup | contentText | Preparing document for printing... |
The following code snippet illustrates you to change the localization to German culture “de-DE”
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
//--
<body>
<div class="content-container-fluid">
<div class="row">
<div class="cols-sample-area">
<table style="width:100%">
<tr>
<td>
<div class="control">
<div id="container"></div>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$("#container").ejPdfViewer({serviceUrl: "/api/PdfViewerAPI" , locale: 'de-DE' });
ej.PdfViewer.Locale["de-DE"] = {
toolbar: {
first: {
headerText: 'Erste',
contentText: 'Gehen Sie auf die erste Seite des PDF-Dokument.'
},
previous: {
headerText: 'Zurück',
contentText: 'Gehen Sie auf die vorherige Seite des PDF-Dokuments.'
},
next: {
headerText: 'Nächster',
contentText: 'Gehen Sie auf die nächste Seite des PDF-Dokuments.'
},
last: {
headerText: 'Letzte',
contentText: 'Gehen Sie auf die letzte Seite des PDF-Dokuments.'
},
zoomIn: {
headerText: 'Hineinzoomen',
contentText: 'Vergrößern Sie das PDF-Dokument.'
},
zoomOut: {
headerText: 'Rauszoomen',
contentText: 'Zoom aus dem PDF-Dokument.'
},
pageIndex: {
headerText: 'Seitennummer',
contentText: 'Aktuelle Seitenzahl, um zu sehen.'
},
zoom: {
headerText: 'Zoom',
contentText: 'Vergrößern oder Verkleinern auf dem PDF-Dokument.'
},
fitToWidth: {
headerText: 'An Breite anpassen',
contentText: 'Montieren Sie die PDF-Seite an die Breite des Behälters.'
},
fitToPage: {
headerText: 'An Seite anpassen',
contentText: 'Montieren Sie die PDF-Seite in den Behälter.'
},
print: {
headerText: ' Drucken',
contentText: ' Drucken Sie das PDF-Dokument.'
},
download: {
headerText: ' Herunterladen',
contentText: ' Laden Sie das PDF-Dokument'
},
search: {
headerText: 'Suche Text',
contentText: 'Suchen Sie Text in den PDF-Seiten.'
},
highlight: {
headerText: 'hervorheben Text',
contentText: 'Markieren Sie Text in den PDF-Seiten.',
},
strikeout: {
headerText: 'StrikeOut Text',
contentText: 'Strike Out Text in den PDF-Seiten.',
},
underline: {
headerText: 'unterstreichen Text',
contentText: 'Unterstreichen Sie den Text in den PDF-Seiten.',
},
signature: {
headerText: 'Unterschrift',
contentText: 'Hinzufügen oder Erstellen der handschriftlichen Unterschrift.',
},
select: {
headerText: 'Auswahl',
contentText: 'Auswahlwerkzeug für Text.',
},
scroll: {
headerText: 'Schwenken',
contentText: 'Klicken Sie, um das Dokument zu verschieben',
}
},
contextMenu: {
copy: {
contentText: 'Kopieren',
},
googleSearch: {
contentText: 'Google suchen',
},
Find: {
contentText: 'Finden:',
},
matchCase: {
contentText: 'MatchCase',
},
auto: {
contentText: 'Auto',
},
openPopup: {
contentText: 'Open Pop-Up Note',
},
Delete: {
contentText: 'Löschen',
},
properties: {
contentText: 'Eigenschaften....',
},
},
propertyWindow: {
underlineProperties: {
contentText: "Unterstreichen"
},
strikeOutProperties: {
contentText: "StrikeOutProperties"
},
highlightProperties: {
contentText: "Markieren Sie die Eigenschaften"
},
signatureProperties: {
contentText: "Unterschrift Eigenschaften"
},
appearance: {
contentText: "das Auftreten"
},
general: {
contentText: "General"
},
color: {
contentText: "Farbe:"
},
opacity: {
contentText: "Opazität:"
},
author: {
contentText: "Autor:"
},
subject: {
contentText: "Fach:"
},
modified: {
contentText: "geändert:"
},
ok: {
contentText: "OK"
},
cancel: {
contentText: "stornieren"
},
locked: {
contentText: "eingesperrt"
}
},
signatureWindow: {
Signature: {
contentText: "Signatur hinzufügen"
},
Add: {
contentText: "Hinzufügen"
},
clear: {
contentText: "Klar"
},
},
waitingPopup: {
print: {
contentText: "Forbereder dokument til udskrivning ..."
}
}
};
});
</script>
</body>
</html>
The following screenshot shows the PDF viewer with tooltip in German language.
Sample:
http://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfViewer_Localization338521894