Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6350961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:54:38+00:00 2026-05-24T21:54:38+00:00

I have decided to use ResourceBundles to provide translations for my php application. While

  • 0

I have decided to use ResourceBundles to provide translations for my php application. While the ResourceBundle (http://www.php.net/manual/en/class.resourcebundle.php) functionality is quite new, I prefer the way it works over gettext.

The question I have is that are there any good ResourceBundle editors? In particular I am looking for one that will scan all my source files and generate a list of message IDs that require translations and/or updating.

Previously, I have used POEdit to generate translation files for gettext. It is able to scan my source files for functions such as _() and hand me a list of message ids to translate.

I have tried installing an eclipse plugin (http://sourceforge.net/projects/eclipse-rbe/) and while it has a nice GUI, it doesn’t scan my source files to generate a list of message IDs to translate.

Could anyone recommend any resource bundle editors?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:54:38+00:00Added an answer on May 24, 2026 at 9:54 pm

    After spending most of the day trying out loads of different tools and what not, I have devised this workflow, and howpfully it will help others as well.

    ResourceBundles are quite new to PHP and there isn’t really much information. Surprisingly, while resource bundles have been used by various languages such as Java for quite a while, I wasn’t able to find any tools that can deal with RBs in a general manner.

    SirDarius’s suggestion to try RB Manager was a good start. It’s straight forward to use, but there are some issues:

    • To scan your source code, you need to set up the scanner using an xml file, which might not be intuitive.
    • More importantly, the scanner will report a list of unused keys and new keys. These still need to be manually added into your resource bundles using the RB Manager main application.
    • Finally, the ICU files exported by RB Manager are broken. Where as content should be exported as just content by itself, somehow RB Manager converts them into the decimal equivalent of the ASCII code. This makes the file to be unuseable.

    I have tried various tools to convert between formats, namely the XLIFF format, but I find that the XLIFF files generated are often malformed, and the next piece of software would refuse to process it.

    For those who might run into this issue in the future, here is what I have done:

    1. I am assuming that you will have some classes or function to wrap around the MessageFormatter and ResourceBundle classes. In my application, I use something like $translate->_('text'); to perform translation. The trick is to use POEdit. POEdit will scan your source files for _() and get a list of keys and remove old keys. Remember that in MessageFormatter, you only use a message id, for example system.warning.reason instead of a full string “Your action was denied. This has been logged”.

    2. You should then use POEdit to write your translations. Dealing with plurals is a bit different. You should not set up any rules for dealing with plurals. Dealing with plurals is done inline for the translation string, which is really flexible. See here: http://userguide.icu-project.org/formatparse/messages for some examples.

    3. Once your translation has been completed, I wrote a small PHP script to convert the .mo files generated by POEdit into the equivalent ICU files.For parsing the .mo files, I used the gettext adapter in Zend_Translate. It also contained a function to grab all message IDs and messages, which is extremely useful. You then convert that data into ICU format like so:

      root    {
      
          // message ID {" Pattern "}
      
          system.warning.reason   { "Your action was denied. This has been logged" }
      }
      

    Once this is done, you need to download the ICU package from : http://site.icu-project.org/download. In the bin directory, you will find an executable called genrb, which compiles the resourcebundle into a binary for PHP to use.

    The command is genrb inputfile.txt -e UTF-8 notice that the input encoding is specified as UTF-8. You can change this to whatever encoding your input files uses.

    That’s it. I believe this is the simpliest and most productive workflow when generating and translating resourcebundles for PHP.

    If anyone comes up with a better way, or perhaps even a full standalone program to take care of this, please post a comment!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a web application (PHP) for my friend and have decided to use
I am building an asp.net mvc3 application and I have decided to use areas
I have started a new web application and have decided to use jquery as
I've been developing a site using ASP.NET MVC, and have decided to use the
I have decided to use ASP.NET MVC to develop multi page (registration) forms in
I am updating a web application and have decided to use SubSonic as it
I have decided to use a silverlight player on my ASP.NET WebApp ,I haven't
We have to introduce logging in our application. We have decided to use log4j
I have decided to use ASP.NET MVC for a website project and want to
I have decided to use the singleton pattern for my application. It makes the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.