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.

Files for po-language-server, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size po_language_server-0.0.2-py3-none-any.whl (3.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size po-language-server-0.0.2.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page