diff --git a/.gitignore b/.gitignore index c30a7de..4501048 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ build/ js/ server/config.js server/docker-compose.yml +translationtool.phar + +*.mo +*.po~ diff --git a/.l10nignore b/.l10nignore new file mode 100644 index 0000000..44ea448 --- /dev/null +++ b/.l10nignore @@ -0,0 +1,2 @@ +js/loader.js +js/pdfdraw.js diff --git a/Makefile b/Makefile index 0658514..e523640 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,29 @@ sign_dir=$(build_dir)/sign package_name=$(app_name) cert_dir=$(HOME)/.nextcloud/certificates +POT_FILES=$(wildcard translationfiles/*/pdfdraw.po) + all: npm build +translationtool.phar: + curl -L -o translationtool.phar https://github.com/nextcloud/docker-ci/raw/master/translations/translationtool/translationtool.phar + chmod a+x translationtool.phar + +.PHONY: pot +pot: translationtool.phar + ./translationtool.phar create-pot-files + sed -i "s|$(CURDIR)/||" translationfiles/templates/pdfdraw.pot + +.PHONY: po +po: $(POT_FILES) + +translationfiles/%/pdfdraw.po: translationtool.phar pot + msgmerge --update $@ translationfiles/templates/pdfdraw.pot + +.PHONY: l10n +l10n: translationtool.phar + ./translationtool.phar convert-po-files + npm: package.json package-lock.json npm install diff --git a/appinfo/info.xml b/appinfo/info.xml index c13b573..9e0aa7e 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -1,7 +1,7 @@ pdfdraw - PDF annotations + PDF Annotations l10n->t("FileId is empty")]; + return [NULL, $this->l10n->t("FileId is empty.")]; } if ($userId !== NULL) { @@ -159,19 +159,19 @@ class ViewerController extends Controller { } if (empty($files)) { - return [NULL, $this->l10n->t("File not found")]; + return [NULL, $this->l10n->t("File not found.")]; } $file = $files[0]; if (!$file->isReadable()) { - return [NULL, $this->l10n->t("You do not have enough permissions to view the file")]; + return [NULL, $this->l10n->t("You do not have enough permissions to view the file.")]; } return [$file, NULL]; } private function getShare($token) { if (empty($token)) { - return [NULL, $this->l10n->t("Token is empty")]; + return [NULL, $this->l10n->t("Token is empty.")]; } $share; @@ -183,13 +183,13 @@ class ViewerController extends Controller { } if ($share === NULL || $share === false) { - return [NULL, $this->l10n->t("You do not have enough permissions to view the file")]; + return [NULL, $this->l10n->t("You do not have enough permissions to view the file.")]; } if ($share->getPassword() && (!$this->session->exists("public_link_authenticated") || $this->session->get("public_link_authenticated") !== (string) $share->getId())) { - return [NULL, $this->l10n->t("You do not have enough permissions to view the file")]; + return [NULL, $this->l10n->t("You do not have enough permissions to view the file.")]; } return [$share, NULL]; @@ -203,20 +203,20 @@ class ViewerController extends Controller { } if (($share->getPermissions() & Constants::PERMISSION_READ) === 0) { - return [NULL, $this->l10n->t("You do not have enough permissions to view the file")]; + return [NULL, $this->l10n->t("You do not have enough permissions to view the file.")]; } try { $node = $share->getNode(); } catch (NotFoundException $e) { $this->logger->error("getFileByToken error: " . $e->getMessage(), array("app" => $this->appName)); - return [NULL, $this->l10n->t("File not found")]; + return [NULL, $this->l10n->t("File not found.")]; } if ($node instanceof Folder) { $files = $node->getById($fileId); if (empty($files)) { - return [NULL, $this->l10n->t("File not found")]; + return [NULL, $this->l10n->t("File not found.")]; } $file = $files[0]; } else { @@ -272,7 +272,7 @@ class ViewerController extends Controller { $mime = strtolower($mime); } if (!in_array($mime, self::PDF_MIME_TYPES)) { - return $this->l10n->t('File %s is not a PDF file (%s)', [$file->getName(), $mime]); + return $this->l10n->t('File %s is not a PDF file (%s).', [$file->getName(), $mime]); } return null; @@ -453,7 +453,7 @@ class ViewerController extends Controller { 'message' => 'download: ' . $token, 'app' => $this->appName, ]); - return new JSONResponse(["message" => $this->l10n->t("Invalid token")], Http::STATUS_FORBIDDEN); + return new JSONResponse(["message" => $this->l10n->t("Invalid token.")], Http::STATUS_FORBIDDEN); } if ($this->userSession->isLoggedIn()) { @@ -470,7 +470,7 @@ class ViewerController extends Controller { } if ($this->userSession->isLoggedIn() && !$file->isReadable()) { - return new JSONResponse(["message" => $this->l10n->t("Access denied")], Http::STATUS_FORBIDDEN); + return new JSONResponse(["message" => $this->l10n->t("Access denied.")], Http::STATUS_FORBIDDEN); } return new DataDisplayResponse($file->getContent(), Http::STATUS_OK, [ diff --git a/templates/viewer.php b/templates/viewer.php index 2a30c6e..4393891 100644 --- a/templates/viewer.php +++ b/templates/viewer.php @@ -50,16 +50,16 @@ See https://github.com/adobe-type-tools/cmap-resources
- Establishing connection, please wait... + t('Establishing connection, please wait...')) ?>
- The connection is interrupted, reconnecting... + t('The connection is interrupted, reconnecting...')) ?>
- Generating combined PDF, please wait... + t('Generating combined PDF, please wait...')) ?>
- PDF generation failed, please try again later. + t('PDF generation failed, please try again later.')) ?>
@@ -219,17 +219,25 @@ See https://github.com/adobe-type-tools/cmap-resources