sponsor Vim development Vim logo Vim Book Ad

po.vim : ftplugin for easier editing of GNU gettext PO files

 script karma  Rating 305/109, Downloaded by 6059  Comments, bugs, improvements  Vim wiki

created by
Aleksandar Jelenak
 
script type
ftplugin
 
description
This file is a Vim ftplugin for editing PO files (GNU gettext -- the GNU
i18n and l10n system). It automates over a dozen frequent tasks that
occur while editing files of this type.

                                                                                    Key mappings
Action (Insert mode)                                                GUI Vim     Vim
===============================================================
Move to an untransl. string forward                       <S-F1>      \m
Move to an untransl. string backward                   <S-F2>       \p
Copy the msgid string to msgstr                            <S-F3>      \c
Delete the msgstr string                                           <S-F4>      \d
Move to the next fuzzy translation                         <S-F5>       \f
Move to the previous fuzzy translation                 <S-F6>       \b
Label the translation fuzzy                                       <S-F7>      \z
Remove the fuzzy label                                            <S-F8>      \r
Show msgfmt statistics for the file(*)                      <S-F11>     \s
Browse through msgfmt errors for the file(*)         <S-F12>     \e
Put the translator info in the header                             \t             \t
Put the lang. team info in the header                           \l             \l
---------------------------------------------------------------
(*) Only available on UNIX computers.


                                                                                  Key mappings
Action (Normal mode)                                           GUI Vim     Vim
===============================================================
Move to an untransl. string forward                      <S-F1>      \m
Move to an untransl. string backward                  <S-F2>      \p
Move to the next fuzzy translation                        <S-F5>      \f
Move to the previous fuzzy translation                <S-F6>      \b
Label the translation fuzzy                                     <S-F7>      \z
Remove the fuzzy label                                          <S-F8>      \r
Split-open the file under cursor                                  gf           gf
Show msgfmt statistics for the file(*)                    <S-F11>     \s
Browse through msgfmt errors for the file(*)       <S-F12>     \e
Put the translator info in the header                            \t            \t
Put the lang. team info in the header                          \l            \l
---------------------------------------------------------------
(*) Only available on UNIX computers.

Remarks:
- "S" in the above key mappings stands for the <Shift> key and "\" in
  fact means "<LocalLeader>" (:help <LocalLeader>), which is "\" by
  Vim's default.
- Information about the translator and language team is supplied by two
  global variables: 'g:po_translator' and 'g:po_lang_team'. They should
  be defined in the ".vimrc" (UNIX) or "_vimrc" (Windows) file. If they
  are not defined, the default values (descriptive strings) are put
  instead.
- Vim's "gf" Normal mode command is remapped (local to the PO buffer, of
  course). It will only function on lines starting with "#: ". Search
  for the file is performed in the directories specified by the 'path'
  option. The user can supply its own addition to this option via the
  'g:po_path' global variable. Its default value for PO files can be
  found by typing ":set path?" from within a PO buffer. For the correct
  format please see ":help 'path'". Warning messages are printed if no
  or more than one file is found.
- Vim's Quickfix mode (see ":help quickfix") is used for browsing
  through msgfmt-reported errors for the file. No MO file is created
  when running the msgfmt program since its output is directed to
  "/dev/null". The user can supply command-line arguments to the msgfmt
  program via the global variable 'g:po_msgfmt_args'. All arguments are
  allowed except the "-o" for output file. The default value is
  "-vv -c".

But there's even more!

Every time the PO file is saved, a PO-formatted time stamp is
automatically added to the file header.
 
install details
    Put this file in a Vim ftplugin directory. On UNIX computers it is
    usually either "~/.vim/ftplugin" or "~/.vim/after/ftplugin". On Windows
    computers, the defaults are "$VIM\vimfiles\ftplugin" or
    "$VIM\vimfiles\after\ftplugin". For more information consult the Vim
    help, ":help 'ftplugin'" and ":help 'runtimepath'".
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
po.vim 1.2 2005-04-13 6.0 Aleksandar Jelenak No major new features, mainly work under the hood to strengthen
current functionality.

Changes:

- Smarter handling of fuzzy translation marks
- New key mappings for some commands in Normal mode
- More commands available in Normal mode
- gf mapping should hopefully be more useful now
po.vim 1.11 2003-07-10 6.0 Aleksandar Jelenak Minor update to ver. 1.1: Running msgfmt statistics for the PO file does
not produce a 'message' output file anymore.
ip used for rating: 3.89.56.228

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github