Skip to content

Commit f0493e3

Browse files
authored
Merge pull request #49 from opendocument-app/feature/localization
Feature/localization
2 parents 6087a21 + c94ce6e commit f0493e3

File tree

19 files changed

+1208
-24
lines changed

19 files changed

+1208
-24
lines changed

OpenDocumentReader/DocumentBrowserViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ class DocumentBrowserViewController: UIDocumentBrowserViewController, UIDocument
4646

4747
func documentBrowser(_ controller: UIDocumentBrowserViewController, failedToImportDocumentAt documentURL: URL, error: Error?) {
4848
let alert = UIAlertController(
49-
title: "Unable to Import Document",
50-
message: "An error occurred while trying to import a document: \(error?.localizedDescription ?? "No Description")",
49+
title: "",
50+
message: NSLocalizedString("alert_error_generic", comment: ""),
5151
preferredStyle: .alert)
5252

5353
let action = UIAlertAction(
54-
title: "OK",
54+
title: NSLocalizedString("ok", comment: ""),
5555
style: .cancel,
5656
handler: nil)
5757

OpenDocumentReader/DocumentViewController.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ class DocumentViewController: UIViewController, DocumentDelegate {
115115
}
116116

117117
if doc.edit {
118-
let alert = UIAlertController(title: "You have unsaved changes", message: "Save them now?", preferredStyle: .alert)
119-
alert.addAction(UIAlertAction(title: "No", style: .destructive, handler: { (_) in
118+
let alert = UIAlertController(title: NSLocalizedString("alert_unsaved_changes", comment: ""), message: NSLocalizedString("alert_save_now", comment: ""), preferredStyle: .alert)
119+
alert.addAction(UIAlertAction(title: NSLocalizedString("no", comment: ""), style: .destructive, handler: { (_) in
120120
Analytics.logEvent("alert_unsaved_changes_no", parameters: nil)
121121

122122
self.discardChanges()
123123
self.closeCurrentDocument()
124124
}))
125-
alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: { (_) in
125+
alert.addAction(UIAlertAction(title: NSLocalizedString("yes", comment: ""), style: .default, handler: { (_) in
126126
Analytics.logEvent("alert_unsaved_changes_yes", parameters: nil)
127127

128128
self.saveContent()
@@ -152,31 +152,31 @@ class DocumentViewController: UIViewController, DocumentDelegate {
152152
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
153153

154154
if (document?.isOdf ?? false && !(document?.edit ?? false)) {
155-
alert.addAction(UIAlertAction(title: "Edit (EXPERIMENTAL)", style: .default, handler: { (_) in
155+
alert.addAction(UIAlertAction(title: NSLocalizedString("menu_edit", comment: ""), style: .default, handler: { (_) in
156156
self.editDocument()
157157
}))
158158
}
159159

160160
if document?.edit ?? false {
161-
alert.addAction(UIAlertAction(title: "Save", style: .default, handler: { (_) in
161+
alert.addAction(UIAlertAction(title: NSLocalizedString("menu_save", comment: ""), style: .default, handler: { (_) in
162162
self.saveContent()
163163
}))
164164

165-
alert.addAction(UIAlertAction(title: "Discard changes", style: .default, handler: { (_) in
165+
alert.addAction(UIAlertAction(title: NSLocalizedString("menu_discard_changes", comment: ""), style: .default, handler: { (_) in
166166
self.discardChanges()
167167
}))
168168
}
169169

170-
alert.addAction(UIAlertAction(title: "Fullscreen", style: .default, handler: { (_) in
170+
alert.addAction(UIAlertAction(title: NSLocalizedString("menu_fullscreen", comment: ""), style: .default, handler: { (_) in
171171
self.toggleFullscreen()
172172
}))
173-
alert.addAction(UIAlertAction(title: "Print", style: .default, handler: { (_) in
173+
alert.addAction(UIAlertAction(title: NSLocalizedString("menu_cloud_print", comment: ""), style: .default, handler: { (_) in
174174
self.printDocument()
175175
}))
176-
alert.addAction(UIAlertAction(title: "Help!?", style: .default, handler: { (_) in
176+
alert.addAction(UIAlertAction(title: NSLocalizedString("menu_help", comment: ""), style: .default, handler: { (_) in
177177
self.showWebsite()
178178
}))
179-
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
179+
alert.addAction(UIAlertAction(title: NSLocalizedString("cancel", comment: ""), style: .cancel, handler: nil))
180180

181181
alert.popoverPresentationController?.sourceView = menuButton.value(forKey: "view") as? UIView
182182
self.present(alert, animated: true, completion: nil)
@@ -207,10 +207,10 @@ class DocumentViewController: UIViewController, DocumentDelegate {
207207
let message: String
208208
let color: UIColor
209209
if success {
210-
message = "Successfully saved"
210+
message = NSLocalizedString("alert_document_saved", comment: "")
211211
color = .green
212212
} else {
213-
message = "Error while saving"
213+
message = NSLocalizedString("alert_error_save_failed", comment: "")
214214
color = .red
215215
}
216216

@@ -280,14 +280,14 @@ class DocumentViewController: UIViewController, DocumentDelegate {
280280
})
281281
}
282282

283-
let alert = UIAlertController(title: "Document encrypted", message: "Please enter the password to decrypt this document", preferredStyle: .alert)
283+
let alert = UIAlertController(title: NSLocalizedString("alert_error_password_protected", comment: ""), message: NSLocalizedString("alert_enter_password", comment: ""), preferredStyle: .alert)
284284
alert.addTextField { (textField) in
285285
textField.text = ""
286286
}
287-
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { [] (_) in
287+
alert.addAction(UIAlertAction(title: NSLocalizedString("cancel", comment: ""), style: .cancel, handler: { [] (_) in
288288
self.returnToDocuments("nil" as Any)
289289
}))
290-
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { [weak alert] (_) in
290+
alert.addAction(UIAlertAction(title: NSLocalizedString("ok", comment: ""), style: .default, handler: { [weak alert] (_) in
291291
let textField = alert?.textFields![0]
292292

293293
self.document?.password = textField!.text!

OpenDocumentReader/PageViewController.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class PageViewController: UIPageViewController {
1212

1313
let contentViewController = "contentViewController"
1414

15-
var headersArray = [Constants.onboarding_header_1,
16-
Constants.onboarding_header_2,
17-
Constants.onboarding_header_3]
18-
var subHeadersArray = [Constants.onboarding_subheader_1,
19-
Constants.onboarding_subheader_2,
20-
Constants.onboarding_subheader_3]
15+
var headersArray = [NSLocalizedString("intro_title_1", comment: ""),
16+
NSLocalizedString("intro_title_2", comment: ""),
17+
NSLocalizedString("intro_title_3", comment: ""),]
18+
var subHeadersArray = [NSLocalizedString("intro_description_1", comment: ""),
19+
NSLocalizedString("intro_description_2", comment: ""),
20+
NSLocalizedString("intro_description_3", comment: ""),]
2121
var imagesArray = [Constants.onboarding_image_1,
2222
Constants.onboarding_image_2,
2323
Constants.onboarding_image_3]
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* */
2+
"alert_error_generic" = "Hi ha hagut un problema. No s'ha pogut obrir el fitxer.";
3+
4+
/* */
5+
"ok" = "OK";
6+
7+
/* */
8+
"no_description" = "No Description";
9+
10+
/* */
11+
"alert_unsaved_changes" = "You have unsaved changes";
12+
13+
/* */
14+
"alert_save_now" = "Save them now?";
15+
16+
/* */
17+
"yes" = "Yes";
18+
19+
/* */
20+
"no" = "No";
21+
22+
/* */
23+
"menu_edit" = "Edit document";
24+
25+
/* */
26+
"menu_save" = "Save";
27+
28+
/* */
29+
"menu_discard_changes" = "Discard changes";
30+
31+
/* */
32+
"menu_fullscreen" = "Mode de pantalla completa";
33+
34+
/* */
35+
"menu_cloud_print" = "Google Cloud Print";
36+
37+
/* */
38+
"menu_help" = "Help!?";
39+
40+
/* */
41+
"cancel" = "Cancel";
42+
43+
/* */
44+
"alert_document_saved" = "Document saved";
45+
46+
/* */
47+
"alert_error_save_failed" = "File could not be saved. Please contact support@opendocument.app";
48+
49+
/* */
50+
"alert_error_password_protected" = "El document està protegit per contrasenya";
51+
52+
/* */
53+
"alert_enter_password" = "Please enter the password to decrypt this document";
54+
55+
/* */
56+
"intro_title_1" = "Open and read your ODF file on the go!";
57+
58+
/* */
59+
"intro_title_2" = "Found a typo in your document? Now supports modification!";
60+
61+
/* */
62+
"intro_title_3" = "Read your documents from within other apps";
63+
64+
/* */
65+
"intro_description_1" = "OpenDocument Reader allows you to view documents that are stored in OpenDocument format (.odt, .ods, .odp and .odg). These files are usually created using LibreOffice or OpenOffice. This app allows to open such files on your mobile device too, so you can read them on the go.";
66+
67+
/* */
68+
"intro_description_2" = "OpenDocument Reader not only allows to read documents on your mobile device, but also supports modifying them too. Typos are fixed in a breeze, even on the train!";
69+
70+
/* */
71+
"intro_description_3" = "OpenDocument Reader supports a huge range of other apps to open documents from. A colleague sent a presentation via Gmail? Click the attachment and this app is going to open right away!";
72+
73+
74+
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* */
2+
"alert_error_generic" = "Něco se pokazilo. Nelze otevřít soubor.";
3+
4+
/* */
5+
"ok" = "OK";
6+
7+
/* */
8+
"no_description" = "No Description";
9+
10+
/* */
11+
"alert_unsaved_changes" = "You have unsaved changes";
12+
13+
/* */
14+
"alert_save_now" = "Save them now?";
15+
16+
/* */
17+
"yes" = "Yes";
18+
19+
/* */
20+
"no" = "No";
21+
22+
/* */
23+
"menu_edit" = "Upravit dokument";
24+
25+
/* */
26+
"menu_save" = "Uložit";
27+
28+
/* */
29+
"menu_discard_changes" = "Discard changes";
30+
31+
/* */
32+
"menu_fullscreen" = "Celá obrazovka";
33+
34+
/* */
35+
"menu_cloud_print" = "Google Cloud Print";
36+
37+
/* */
38+
"menu_help" = "Help!?";
39+
40+
/* */
41+
"cancel" = "Cancel";
42+
43+
/* */
44+
"alert_document_saved" = "Document saved";
45+
46+
/* */
47+
"alert_error_save_failed" = "File could not be saved. Please contact support@opendocument.app";
48+
49+
/* */
50+
"alert_error_password_protected" = "Dokument je chráněn heslem";
51+
52+
/* */
53+
"alert_enter_password" = "Please enter the password to decrypt this document";
54+
55+
/* */
56+
"intro_title_1" = "Open and read your ODF file on the go!";
57+
58+
/* */
59+
"intro_title_2" = "Found a typo in your document? Now supports modification!";
60+
61+
/* */
62+
"intro_title_3" = "Read your documents from within other apps";
63+
64+
/* */
65+
"intro_description_1" = "OpenDocument Reader allows you to view documents that are stored in OpenDocument format (.odt, .ods, .odp and .odg). These files are usually created using LibreOffice or OpenOffice. This app allows to open such files on your mobile device too, so you can read them on the go.";
66+
67+
/* */
68+
"intro_description_2" = "OpenDocument Reader not only allows to read documents on your mobile device, but also supports modifying them too. Typos are fixed in a breeze, even on the train!";
69+
70+
/* */
71+
"intro_description_3" = "OpenDocument Reader supports a huge range of other apps to open documents from. A colleague sent a presentation via Gmail? Click the attachment and this app is going to open right away!";
72+
73+
74+
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* */
2+
"alert_error_generic" = "Der er gået noget galt. Filen kunne ikke åbnes.";
3+
4+
/* */
5+
"ok" = "OK";
6+
7+
/* */
8+
"no_description" = "No Description";
9+
10+
/* */
11+
"alert_unsaved_changes" = "You have unsaved changes";
12+
13+
/* */
14+
"alert_save_now" = "Save them now?";
15+
16+
/* */
17+
"yes" = "Yes";
18+
19+
/* */
20+
"no" = "No";
21+
22+
/* */
23+
"menu_edit" = "Edit document";
24+
25+
/* */
26+
"menu_save" = "Save";
27+
28+
/* */
29+
"menu_discard_changes" = "Discard changes";
30+
31+
/* */
32+
"menu_fullscreen" = "Open fullscreen mode";
33+
34+
/* */
35+
"menu_cloud_print" = "Print document";
36+
37+
/* */
38+
"menu_help" = "Help!?";
39+
40+
/* */
41+
"cancel" = "Cancel";
42+
43+
/* */
44+
"alert_document_saved" = "Document saved";
45+
46+
/* */
47+
"alert_error_save_failed" = "File could not be saved. Please contact support@opendocument.app";
48+
49+
/* */
50+
"alert_error_password_protected" = "Dokumentet er låst med et kodeord";
51+
52+
/* */
53+
"alert_enter_password" = "Please enter the password to decrypt this document";
54+
55+
/* */
56+
"intro_title_1" = "Open and read your ODF file on the go!";
57+
58+
/* */
59+
"intro_title_2" = "Found a typo in your document? Now supports modification!";
60+
61+
/* */
62+
"intro_title_3" = "Read your documents from within other apps";
63+
64+
/* */
65+
"intro_description_1" = "OpenDocument Reader allows you to view documents that are stored in OpenDocument format (.odt, .ods, .odp and .odg). These files are usually created using LibreOffice or OpenOffice. This app allows to open such files on your mobile device too, so you can read them on the go.";
66+
67+
/* */
68+
"intro_description_2" = "OpenDocument Reader not only allows to read documents on your mobile device, but also supports modifying them too. Typos are fixed in a breeze, even on the train!";
69+
70+
/* */
71+
"intro_description_3" = "OpenDocument Reader supports a huge range of other apps to open documents from. A colleague sent a presentation via Gmail? Click the attachment and this app is going to open right away!";
72+
73+
74+

0 commit comments

Comments
 (0)