Skip to main content

Language Server for gettext po files.

Project description

po-language-server

This is a Markov-chain based completion language server for gettext po files.

Installation

python3 -m pip install po-language-server

It should be compatible with vim, emacs, vscode, and other text editors acting as language server clients. I only tried it using emacs though.

Emacs configuration

I did not packaged it yet (feel free to help), but it's not that hard to configure:

(require 'lsp-mode)

(add-to-list 'lsp-language-id-configuration '(po-mode . "gettext"))

(lsp-register-client
 (make-lsp-client
  :new-connection (lsp-stdio-connection "po-language-server")
  :activation-fn (lsp-activate-on "gettext" "plaintext")
  :priority -1
  :server-id 'po
))
(add-hook 'po-mode-hook #'lsp)

;; lsp-mode can only work on named buffers
(defun po-mode-name-buffer ()
  (setq-local buffer-file-name "msgstr.po")
  (lsp))

(defun po-mode-unname-buffer ()
  (setq-local buffer-file-name nil))

(add-hook 'po-mode-hook
 (lambda ()
   (advice-add 'po-edit-msgstr :after 'po-mode-name-buffer)
   (advice-add 'po-subedit-exit :before 'po-mode-unname-buffer)))

(add-to-list 'lsp-enabled-clients 'po)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

po-language-server-0.0.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

po_language_server-0.0.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file po-language-server-0.0.2.tar.gz.

File metadata

  • Download URL: po-language-server-0.0.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for po-language-server-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2c5a8b33b3c79032b97dfc2805067d18a95a2b1ab96ca8c8bf9ba7409da4d73b
MD5 281d023c4437cde05877d445967e21c0
BLAKE2b-256 c5abe0b59f0e4267c0f9d1b3749881859befefb827ecf05e323e2cd4a304db21

See more details on using hashes here.

File details

Details for the file po_language_server-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: po_language_server-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for po_language_server-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d32187b296ccf6581c01453ce8c402421aed2f03c5d38220e1bd01b77b742feb
MD5 7284688054043dcd4dab6bd2772e2128
BLAKE2b-256 d9dfe5dbb64a0a4b5ffbaf9af4bf674e2b2bfaac95c8c8bc2071b608e539f874

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page