An open API service indexing awesome lists of open source software.

https://github.com/ghidinelli/g11n.cfc

A ColdFusion Component that helps with Globalization (g11n) - Internationalization (i18n) and Localization (l10n)
https://github.com/ghidinelli/g11n.cfc

Last synced: about 11 hours ago
JSON representation

A ColdFusion Component that helps with Globalization (g11n) - Internationalization (i18n) and Localization (l10n)

Awesome Lists containing this project

README

          

# g11n.cfc
A ColdFusion Component that helps with Globalization (g11n) - Internationalization (i18n) and Localization (l10n)

For a primer on Globalization with ColdFusion, check [https://gist.github.com/coldfusionPaul/3779416 this gist] from Paul Hastings (who knows a ton about g11n).

Some assumptions:

* Your content is in utf-8 and stored in the database as unicode
* You have `` everywhere
* You realize the built-in locale name and LS* functions are inadequate

Using g11n.cfc is easy:

```
g11n = createObject("component", "g11n").init(locale = "en_US", tzid = "US/Pacific");
writeOutput(g11n.getDateMask("short")); // M/d/yy h:mm a
writeOutput(g11n.formatDateTime(now(), "short")); // now() formatted as 'M/d/yy h:mm a' in Pacific time
writeOutput(g11n.formatCurrency(50000.50)); // $50,000.50
```

You can also pass the desired locale and timezone to most methods or change the default:

```
writeOutput(g11n.getDateMask(locale = "en_GB", mask = "short")); // dd/MM/yy HH:mm
g11n.setDefaultLocale("en_GB");
writeOutput(g11n.formatCurrency(50000.50)); // £50.000,50
```