changing the currency

  • Hello, how do i change the currency for the payments, charges, fines for late books..i want to change the dollar sign $ to our currency which is philippine peso (Php).

    • Quick answer, not sure if the following will work for you.

      Second subparagraph from
      First, you need to copy all of the files under locale/en to a new directory called locale/xx, where 'xx' is the code you want to use for your locale. There is no current standard for choosing these codes. In the future, we will probably use a lowercase language code followed by an underscore and an uppercase country code, e.g en_US, en_UK, de_DE. But right now most translations just use a lowercase, 2-letter county code.

      OpenBiblio passes the code (based on directory name) to PHP and this sets the locale for the server OpenBiblio is running on.

      This answer does not tell you: 
      - If philippine peso currency is supported by PHP locale
      - What code should be used for the server operating system where your OpenBiblio is installed.

    • Thanks for the help.. ^_^ i really appreciate it. :)

    • This doesnt solve my problem, but thanks a lot ive learned many things.. so that means that i cant change the currency to PHP? coz theirs no current standard for these codes? am i right?

      • I don't have a clue, perhaps you can try:


        Linux / unix:


    • nothing happens.. hehe.. just "L"

    • i have an idea.. how about if i will delete the dollar sign?  but cant find the code where to delete the code.. can you help me?

      • Micah Stetson
        Micah Stetson

        That particular code is rather convoluted because it tries to use PHP's locale functions.  It's in functions/formatFuncs.php and the functions is called moneyFormat().  Depending on your setup, you might be able just to change the line that says "$currencySymbol = '$';".  That sets a default for when the locale data isn't loaded correctly.  If that doesn't work, you'd best rewrite the function, probably with something like this, but adapted to your locale:

        function moneyFormat($amount, $decimals){
          $str = "";
          if ($amount < 0.0) {
            $str .= "-";
          $str .= "$";
          $str .= number_format(abs($amount),$decimals,".",",");
          return $str;

        That code is completely untested and meant only as an example.  Use at your own risk.


    • yay..the currency is now Php..i change the  "$currencySymbol = 'Php';" and change the locale/en to locale/oo, so that it wont load to its default.. thanks a lot.. ^_^

    • succinctus

      Changing the locale to nonsense is not possible with translated localizations. I have had the problem with €.
      Will it prepare problems to change in /funtions/formatFuncs.php:
      $currencySymbol = $localeInfo["currency_symbol"];
        if ($currencySymbol) {
          $currencySymbol = '€';
      ? Not so professional, but it also seems to work.

      • nelsonmhjr

        The OpenBiblio uses localeconv() function from PHP to set local definitions about currency and other things, searching what this functions does I found another function, setlocale() that set the local definitions to your country.

        In my case I put the:

        setlocale (LC_ALL, 'ptb', 'pt_BR');

        in /shared/common.php and it worked to change to Brazilian definitions.

        The two parameters is to work in Windows PHP Servers and Linux PHP Servers respectively.

        In Linux (Slackware 11 is my distribution) there is a "locale -a" command that writes names of all available locales
        For Windows\(VS.71).aspx

        Hope that help.

    • nelsonmhjr

      Maybe it's better put the setlocale in /functions/formatFuncs.php the moneyformat function is there too.

    • nelsonmhjr

      Other Sollution: most "pro"

      Openbiblio sets the setlocale() phpfunction in share/readsettings.php. Uses getLocale() function from Setting class. It gets the locale code from the locale column from settings table in DB, that is the directory name where your locales are. Like Hans van der Weij posted on the second post.

      The problems is that are different codes for windows and unix servers. So you need to rename to the code for your OS.

      In share/readsettings.php there is this code:

      if ($set->getLocale()=="de") {
          setlocale(LC_MONETARY, 'de_DE', 'de_DE@euro', 'de', 'ge', 'deu_deu', 'deu', 'Germany', 'de_DE.ISO8859-1');
          setlocale(LC_NUMERIC, 'de_DE', 'de_DE@euro', 'de', 'ge', 'deu_deu', 'deu', 'Germany', 'de_DE.ISO8859-1');
        } elseif ($set->getLocale()=="en") {
          setlocale(LC_MONETARY,'en_US.iso885915', 'en', 'en_US', 'eng');
          setlocale(LC_NUMERIC,'en_US.iso885915', 'en', 'en_US', 'eng');
        } else {

      It's sets for all possibilities for "de" and "en" locale only, so add your locale directory there too if you need full compatibility.

  • OK guys so I've been working with everything and could not make anything work. I was getting the GBP as my default currency no matter what I did. So i made the following changes :

    1) Go to Functions/formatFuncs

    2)   if ($localeInfo == 0) {
        if ($localeInfo) {
          $result = "(".$currencySymbol.$sep.$result.")";
        } else {
          $result = "(".$result.$sep.$currencySymbol.")";
      }elseif ($localeInfo == 1) {
        if ($localeInfo) {
          $result = $sign.$currencySymbol.$sep.$result;
        } else {
          $result = $sign.$result.$sep.$currencySymbol;
      }elseif ($localeInfo == 2) {
        if ($localeInfo) {
          $result = $currencySymbol.$sep.$result.$sign;
        } else {
          $result = $result.$sep.$currencySymbol.$sign;
      }elseif ($localeInfo == 3) {
        if ($localeInfo) {
          $result = $sign.$currencySymbol.$sep.$result;
        } else {
          $result = $result.$sep.$sign.$currencySymbol;
      }elseif ($localeInfo == 4) {
        if ($localeInfo) {
          $result = $currencySymbol.$sign.$sep.$result;
        } else {
          $result = $result.$sep.$currencySymbol.$sign;
      } else {
        # American-style default
        $result = $currencySymbol.$sep.$sign.$result;

    3. I replaced the $currencySymbol in everyone of this to my currency symbol.

    4. Save this file and you are done. I found that this is one of the easiest ways to change the currency if you do not want to deal with locale.



Cancel   Add attachments