Contributing to rails-i18n

Contributions from the community are what make rails-i18n a valuable resource. Whether you're adding a new locale, completing an existing one, or fixing a bug, your help is welcome.

Contribution Workflow

  1. Fork the Repository: Start by forking the svenfuchs/rails-i18n repository on GitHub.

  2. Clone Your Fork: Clone your forked repository to your local machine.

    git clone https://github.com/YOUR_USERNAME/rails-i18n.git
    cd rails-i18n
  3. Set Up Your Development Environment:

    • Ruby Version: This project requires Ruby 3.2.0 or newer.
    • Dependencies: Install the required gems using Bundler:
      bundle install
  4. Make Your Changes:

    • Create or edit your locale file in the rails/locale/ directory.
    • Use rails/locale/en.yml as the reference for keys and structure.
    • Ensure your files are saved with UTF-8 encoding.
  5. Test Your Changes: Before submitting, run the local test suite and verification scripts.

    • Run RSpec tests:

      bundle exec rake spec

    • Check for completeness: Compare your locale against the English file.

      bundle exec rake i18n-spec:completeness rails/locale/en.yml rails/locale/your_locale.yml

    • Normalize your file: Ensure consistent formatting and key order.

      thor locales:normalize your_locale

  6. Update the README: If you've added a new locale, add its code to the list in README.md.

  7. Submit a Pull Request:

    • Commit your changes and push them to your fork.
    • Open a pull request against the master branch of the original repository.
    • Use a clear and informative title for your PR, e.g., "Danish: Fix typo in da.errors.messages.required".

Using Docker for Development

If you prefer a containerized development environment, you can use the provided Dockerfile.

  1. Build the Docker image:

    docker build --tag=railsi18n .

  2. Run the tests inside the container:

    docker run railsi18n

  3. Run other commands:

    docker run railsi18n thor locales:list

Special Thanks

A special thank you to Tsutomu Kuroda for his tireless dedication to maintaining this repository and managing issues and pull requests.