Skip to content

Support Tool for Internationalization and localization(GNU gettext Plus). With this tool you can greatly reduce the time required to create test scripts. See 'Makefile.am' for practical usage of this tool.

License

Notifications You must be signed in to change notification settings

kimkim19642004/po2bats-autotools

Repository files navigation

IDE Latest release License Build Status Build status Build Status Coverage Status codecov Codacy Badge CodeFactor

Note:

po2bats

This is a shell script to generate BATS file from PO file. Running the bats script allows you to verify the integrity between MO file installed on your system and PO file which is that source file.

Note:

Some of usages of this command are shown below.

How to display help:

$ po2bats.sh --help
Usage: po2bats.sh [OPTION] PO BATS TEXTDOMAIN
Generate BATS file from PO file

OPTION:
      --msgdir=TEXTDOMAINDIR  Specify message catalog search path
      --msginfo               Display message catalog information and exit
      --help                  Display this help and exit
      --version               Display version information and exit

PO: Specify the name of an existing PO file
BATS: Specify the name of a new BATS file
TEXTDOMAIN,TEXTDOMAINDIR:
  See gettext command help for more information: gettext --help

URL: https://github.com/kimkim19642004/po2bats-autotools
Report bugs to: https://github.com/kimkim19642004/po2bats-autotools/issues

How to generate and execute BATS file (Example in Japanese locale):

$ echo $LANG
ja_JP.UTF-8
$ po2bats.sh --msgdir=/usr/local/share/locale po/ja.po ja.bats po2bats
$ ./ja.bats
 ✓ ls /usr/local/share/locale/ja/LC_MESSAGES/po2bats.mo
 ✓ (null)
 ✓ called from an unknown or unsupported shell
 ✓ Unauthorized user
 ✓ Unsupported Shell Options
 ✓ See
 ✓ Usage
 ✓ OPTION
 ✓ Generate BATS file from PO file
 ✓ Specify message catalog search path
 ✓ Display message catalog information and exit
 ✓ Display this help and exit
 ✓ Display version information and exit
 ✓ Specify the name of an existing PO file
 ✓ Specify the name of a new BATS file
 ✓ See gettext command help for more information
 ✓ Report bugs to
 ✓ This GNU command is not installed, or invalid path/link settings.
 ✓ missing file operand
 ✓ Try the following command
 ✓ PO error
 ✓ BATS error
 ✓ TEXTDOMAIN error
 ✓ TEXTDOMAINDIR error
 ✓ This file was automatically generated by po2bats.sh. Do not edit!
 ✓ BATS tempfile error
 ✓ line
 ✓ Test counts
 ✓ Message not found
 ✓ CHECKSUM (message digest) tempfile error
 ✓ CHECKSUM (message digest) for all translated messages
 ✓ cannot move tempfile to target BATS file
 ✓ Target BATS file not found

33 tests, 0 failures

Note:

  • 'ja.po' is an existing Japanese PO file.
  • Place the japanese MO file 'test.mo' in the directory '/usr/local/share/locale/ja/LC_MESSAGES'.
  • You can display the help information about BATS command by executing the command './ja.bats -h'.

Getting Started

The following instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See Deployment for notes on how to deploy the project on a live system.

Prerequisites

Install necessary packages for installing this software.

When the latest version of Fedora is clean installed:

## Installing and updating basic software
$ sudo dnf install dnf-plugins-extras-tracer
$ sudo dnf upgrade
$ sudo dnf groupinstall "C Development Tools and Libraries"
$ sudo dnf groupinstall "Development Tools"
$ sudo dnf install gettext-devel autoconf-archive
$ sudo dnf install bats moreutils lcov ShellCheck

## Requires for [kcov](https://github.com/SimonKagstrom/kcov/)
$ sudo dnf install elfutils-libelf-devel libcurl-devel binutils-devel elfutils-devel cmake

## Manual installation (Example: Japanese)
$ sudo dnf install man-pages-ja glibc-langpack-ja
(Don't forget to check the current locale information with the command 'locale'!)

## Install [kcov](https://github.com/SimonKagstrom/kcov/)
$ cd $HOME
$ git clone https://github.com/SimonKagstrom/kcov.git
$ cd kcov
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install

Follow instructions of the DNF command, restart the specified applications, or reboot your system, or login to your system again.

Note:

  • If Plugin for DNF command dnf-plugins-extras-tracer is installed on your system, the DNF command will display information on running applications that need to be restarted. This plugin is useful, but it may take time to execute. To disable this plugin, specify '--disableplugin=tracer' as the command option.

Installing

Normal installation procedure for this software is as follows:

$ cd $HOME
$ git clone https://github.com/kimkim19642004/po2bats-autotools.git
$ cd po2bats-autotools

## The following is required only after the initial 'git clone'.
## Match the timestamps of the following files with the rules described in 'Makefile'.
$ touch aclocal.m4
$ touch configure
$ touch Makefile.am
$ touch src/Makefile.am
$ touch Makefile.in
$ touch src/Makefile.in

$ ./configure && make
$ sudo make install

Full installation procedure for this software (If you need to rebuild this software) is as follows:

$ cd $HOME
$ git clone https://github.com/kimkim19642004/po2bats-autotools.git
$ cd po2bats-autotools

$ gettextize -f
$ autoreconf -f -i

$ ./configure && make
$ make check
$ make distcheck
$ sudo make install
$ make installcheck

Note:

  • You can generate source files with 100% code coverage by executing the command './configure --enable-code-coverage --enable-testcode'.
  • Open the file '$HOME/po2bats-autotools/tests/coverage/index.html' in your web browser and see the code coverage.
  • See NEWS for installation on other operating systems.
  • Please read INSTALL carefully.

Support Eclipse

See EGit for how to import this project.

Deployment

See Creating RPM packages.

Versioning and ChangeLog

We use SemVer for versioning. For the versions available, see releases.

See Keep a Changelog for how to write 'CHANGELOG.md'.

See Change Logs for how to write GNU Style 'ChangeLog'.

Authors

See AUTHORS for more information.

License

See COPYING for more information.

NEWS

This is a document showing the latest operation confirmation situation etc.

See NEWS for more information.

About

Support Tool for Internationalization and localization(GNU gettext Plus). With this tool you can greatly reduce the time required to create test scripts. See 'Makefile.am' for practical usage of this tool.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published