Giter VIP home page Giter VIP logo

octobercms-plugin-localize's Introduction

Localize Plugin

This plugin allows to create different formats for dates and currencies. The formats can be used on the themes or on the backend.

It needs Rainlab Translate plugin to work.

You don't need to add any component in your theme. The plugin automatically creates filters that you can use in your pages and partials.

Mapping language codes to correct system locale codes

The plugin extends the Rainlab Translate locales with another field that you can use to map the existing locales to the locales in your system, so the date format functions can work. For example, you could map your page locales like this:

en -> en_UK
es -> es_ES
fr -> fr_FR

This can be done from the "Manage languages" section in Translate plugin settings.

Creating formats

The date and currency formats are managed from the plugin settings. Some examples are automatically created.

You need to create a generic format for all locales, and you can create a specific format for each different locale.

You can use your formats from your twig pages and partials like this:

{{ date_field|dateformat_short }}

{{ price_field|currencyformat_euro }}

And from the backend lists like this:

columns:
    price:
        label: 'Date'
        type: dateformat_short

columns:
    price:
        label: 'Product price'
        type: currencyformat_euro

Date formats

The format field accepts the formats accepted by the php funcion strftime. The function field allows you to create your own code.

Currency formats

Currency formats have the following options:

Currency symbol: $, €, EUR, etc. Prepend symbol: if active the symbol will be prepended ($45.26), else it will be appended (45.26€) Separate by space: if active, the value and currency symbol will be separated by a space (45.26 €) Decimals: number of decimals. Set to 0 to disable decimals ($45) Force decimals: if the value has not decimals, and the decimals settings is not 0, whether to show the decimals or not ($45.00 or $45) Decimal point: symbol to use as a the decimal point (i.e. $45.26 or $45,26) Thousands separator: symbol to use as a the thousands separator (i.e. $1,245 or $1.245 or $1 245)

You can also use the function option to create you own code.

octobercms-plugin-localize's People

Contributors

mariavilaro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.