-
Notifications
You must be signed in to change notification settings - Fork 590
Runtime support (smaller and quicker code for production) #436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
2baa331
All: Runtime support (smaller and quicker code for production)
rxaviers a664657
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers 34697a4
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers 6d637fd
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers a03a92d
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers a0fdc94
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers a16e830
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers 57f6a7f
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers 7d081a2
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers d08dba8
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers 5be91cc
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers 02e9756
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers fda340a
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers 598be18
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers 9ac65d0
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers d9aa124
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers e5e38f0
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers 7e5dc91
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers f99fa88
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers 82783f9
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers f716e44
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers c12dfc4
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers 5aab7ae
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers a28fc99
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers 8ae20ba
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers c9e65ad
fixup! All: Runtime support (smaller and quicker code for production)
rxaviers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| compiled-formatters.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Basic Globalize Compiler example | ||
|
|
||
| This example focuses on the Globalize Compiler and the Globalize runtime | ||
| modules. It assumes knowledge of Globalize usage basics. | ||
|
|
||
| ## Requirements | ||
|
|
||
| **1. Install Globalize dependencies and Globalize Compiler** | ||
|
|
||
| This example uses `npm` to download Globalize dependencies (i.e., CLDR data and | ||
| the Cldrjs library) and the [Globalize Compiler][]. | ||
|
|
||
| ``` | ||
| npm install | ||
| ``` | ||
|
|
||
| [Globalize Compiler]: https://github.com/jquery-support/globalize-compiler | ||
|
|
||
| ## Running the example | ||
|
|
||
| ### Development mode | ||
|
|
||
| 1. Start a server by running `python -m SimpleHTTPServer` or other alternative | ||
| servers such as [http-server][], [nginx][], [apache][]. | ||
| 1. Point your browser at `http://localhost:8000/development.html`. Note that the | ||
| formatters are created dynamically. Therefore, Cldrjs and CLDR data are | ||
| required. | ||
| 1. Understand the demo by reading the source code. We have comments there for | ||
| you. | ||
|
|
||
| [http-server]: https://github.com/nodeapps/http-server | ||
| [nginx]: http://nginx.org/en/docs/ | ||
| [apache]: http://httpd.apache.org/docs/trunk/ | ||
|
|
||
| ### Production mode | ||
|
|
||
| 1. Compile the application formatters by running `npm run build`. See | ||
| `package.json` to understand the actual shell command that is used. For more | ||
| information about the compiler, see the [Globalize Compiler documentation][]. | ||
| 1. Point your browser at `./production.html`. Note that we don't need Cldrjs nor | ||
| CLDR data in production here. | ||
| 1. Understand the demo by reading the source code. We have comments there for | ||
| you. | ||
|
|
||
| [Globalize Compiler documentation]: https://github.com/jquery-support/globalize-compiler#README |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| var like, number; | ||
|
|
||
| // Set default locale as "en". | ||
| Globalize.locale( "en" ); | ||
|
|
||
| // Use Globalize to format dates. | ||
| document.getElementById( "date" ).innerHTML = Globalize.formatDate( new Date(), { | ||
| datetime: "medium" | ||
| }); | ||
|
|
||
| // Use Globalize to format numbers. | ||
| number = Globalize.numberFormatter(); | ||
| document.getElementById( "number" ).innerHTML = number( 12345.6789 ); | ||
|
|
||
| // Use Globalize to format currencies. | ||
| document.getElementById( "currency" ).innerHTML = Globalize.formatCurrency( 69900, "USD" ); | ||
|
|
||
| // Use Globalize to get the plural form of a numeric value. | ||
| document.getElementById( "plural-number" ).innerHTML = number( 12345.6789 ); | ||
| document.getElementById( "plural-form" ).innerHTML = Globalize.plural( 12345.6789 ); | ||
|
|
||
| // Use Globalize to format a message with plural inflection. | ||
| like = Globalize.messageFormatter( "like" ); | ||
| document.getElementById( "message-0" ).innerHTML = like( 0 ); | ||
| document.getElementById( "message-1" ).innerHTML = like( 1 ); | ||
| document.getElementById( "message-2" ).innerHTML = like( 2 ); | ||
| document.getElementById( "message-3" ).innerHTML = like( 3 ); | ||
|
|
||
| // Use Globalize to format a relative time. | ||
| document.getElementById( "relative-time" ).innerText = Globalize.formatRelativeTime( -35, "second" ); | ||
|
|
||
| document.getElementById( "requirements" ).style.display = "none"; | ||
| document.getElementById( "demo" ).style.display = "block"; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content team (cc @arthurvr @agcolom @kswedberg who has helped reviewing past doc changes), please just let me know if you have thoughts for improvements. Thanks in advance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PS: Save your time by ignoring the file renames. :P