utopia 2.13.4 → 2.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/development.yml +62 -0
- data/README.md +3 -5
- data/bake/utopia/yarn.rb +4 -2
- data/docs/_components/jquery-litebox/jquery.litebox.css +23 -0
- data/docs/_components/jquery-litebox/jquery.litebox.gallery.css +48 -0
- data/docs/_components/jquery-litebox/jquery.litebox.js +30 -0
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.apache.css +6 -0
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.bash.css +4 -10
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.clang.css +5 -2
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.diff.css +8 -8
- data/docs/_components/jquery-syntax/base/jquery.syntax.brush.ruby.css +1 -1
- data/docs/_components/jquery-syntax/base/jquery.syntax.core.css +43 -47
- data/docs/_components/jquery-syntax/jquery.syntax.brush.apache.js +3 -41
- data/docs/_components/jquery-syntax/jquery.syntax.brush.applescript.js +5 -57
- data/docs/_components/jquery-syntax/jquery.syntax.brush.assembly.js +3 -37
- data/docs/_components/jquery-syntax/jquery.syntax.brush.bash-script.js +4 -67
- data/docs/_components/jquery-syntax/jquery.syntax.brush.bash.js +2 -33
- data/docs/_components/jquery-syntax/jquery.syntax.brush.basic.js +5 -51
- data/docs/_components/jquery-syntax/jquery.syntax.brush.clang.js +5 -89
- data/docs/_components/jquery-syntax/jquery.syntax.brush.csharp.js +4 -47
- data/docs/_components/jquery-syntax/jquery.syntax.brush.css.js +5 -80
- data/docs/_components/jquery-syntax/jquery.syntax.brush.diff.js +2 -24
- data/docs/_components/jquery-syntax/jquery.syntax.brush.go.js +3 -47
- data/docs/_components/jquery-syntax/jquery.syntax.brush.haskell.js +3 -45
- data/docs/_components/jquery-syntax/jquery.syntax.brush.html.js +4 -66
- data/docs/_components/jquery-syntax/jquery.syntax.brush.io.js +3 -45
- data/docs/_components/jquery-syntax/jquery.syntax.brush.java.js +4 -45
- data/docs/_components/jquery-syntax/jquery.syntax.brush.javascript.js +3 -40
- data/docs/_components/jquery-syntax/jquery.syntax.brush.kai.js +2 -29
- data/docs/_components/jquery-syntax/jquery.syntax.brush.lisp.js +2 -34
- data/docs/_components/jquery-syntax/jquery.syntax.brush.lua.js +3 -44
- data/docs/_components/jquery-syntax/jquery.syntax.brush.nginx.js +2 -31
- data/docs/_components/jquery-syntax/jquery.syntax.brush.ocaml.js +4 -73
- data/docs/_components/jquery-syntax/jquery.syntax.brush.ooc.js +4 -46
- data/docs/_components/jquery-syntax/jquery.syntax.brush.pascal.js +4 -51
- data/docs/_components/jquery-syntax/jquery.syntax.brush.perl5.js +3 -52
- data/docs/_components/jquery-syntax/jquery.syntax.brush.php-script.js +4 -48
- data/docs/_components/jquery-syntax/jquery.syntax.brush.php.js +2 -15
- data/docs/_components/jquery-syntax/jquery.syntax.brush.plain.js +2 -10
- data/docs/_components/jquery-syntax/jquery.syntax.brush.protobuf.js +3 -43
- data/docs/_components/jquery-syntax/jquery.syntax.brush.python.js +5 -44
- data/docs/_components/jquery-syntax/jquery.syntax.brush.ruby.js +5 -77
- data/docs/_components/jquery-syntax/jquery.syntax.brush.scala.js +4 -44
- data/docs/_components/jquery-syntax/jquery.syntax.brush.smalltalk.js +2 -29
- data/docs/_components/jquery-syntax/jquery.syntax.brush.sql.js +4 -31
- data/docs/_components/jquery-syntax/jquery.syntax.brush.super-collider.js +3 -57
- data/docs/_components/jquery-syntax/jquery.syntax.brush.swift.js +3 -55
- data/docs/_components/jquery-syntax/jquery.syntax.brush.trenni.js +2 -35
- data/docs/_components/jquery-syntax/jquery.syntax.brush.xml.js +4 -50
- data/docs/_components/jquery-syntax/jquery.syntax.brush.yaml.js +2 -29
- data/docs/_components/jquery-syntax/jquery.syntax.cache.js +7 -65
- data/docs/_components/jquery-syntax/jquery.syntax.core.js +34 -1098
- data/docs/_components/jquery-syntax/jquery.syntax.editor.js +11 -291
- data/docs/_components/jquery-syntax/jquery.syntax.js +8 -258
- data/docs/_components/jquery/jquery.js +1678 -1026
- data/docs/_components/jquery/jquery.min.js +2 -4
- data/docs/_components/jquery/jquery.min.map +1 -1
- data/docs/_components/jquery/jquery.slim.js +1602 -932
- data/docs/_components/jquery/jquery.slim.min.js +2 -4
- data/docs/_components/jquery/jquery.slim.min.map +1 -1
- data/docs/_static/icon.png +0 -0
- data/docs/_static/site.css +100 -114
- data/docs/{wiki/development-environment-setup.html → development-environment-setup/index.html} +9 -15
- data/docs/{wiki/faq/what-is-xnode.html → faq/what-is-xnode/index.html} +9 -15
- data/docs/index.html +25 -31
- data/docs/javascript/index.html +108 -0
- data/docs/{wiki/middleware/content.html → middleware/content/index.html} +9 -15
- data/docs/{wiki/middleware/controller/actions.html → middleware/controller/actions/index.html} +11 -17
- data/docs/{wiki/middleware/controller.html → middleware/controller/index.html} +9 -15
- data/docs/{wiki/middleware/controller/rewrite.html → middleware/controller/rewrite/index.html} +9 -15
- data/docs/{wiki/middleware/localization.html → middleware/localization/index.html} +9 -15
- data/docs/{wiki/middleware/redirection.html → middleware/redirection/index.html} +9 -15
- data/docs/{wiki/middleware/session.html → middleware/session/index.html} +9 -15
- data/docs/{wiki/middleware/static.html → middleware/static/index.html} +9 -15
- data/docs/{wiki/server-setup.html → server-setup/index.html} +11 -42
- data/docs/{wiki/testing.html → testing/index.html} +10 -16
- data/docs/{wiki/updating-utopia.html → updating-utopia/index.html} +9 -15
- data/docs/{wiki/your-first-page.html → your-first-page/index.html} +11 -17
- data/lib/utopia/content.rb +23 -19
- data/lib/utopia/content/link.rb +29 -34
- data/lib/utopia/content/links.rb +185 -123
- data/lib/utopia/content/node.rb +13 -17
- data/lib/utopia/content/response.rb +2 -2
- data/lib/utopia/localization.rb +18 -10
- data/lib/utopia/path.rb +36 -32
- data/lib/utopia/version.rb +1 -1
- data/setup/site/Gemfile +7 -5
- data/spec/utopia/command_spec.rb +1 -1
- data/spec/utopia/content/links/bar/index.xnode +0 -0
- data/spec/utopia/content/links/bar/parent/child/index.en.xnode +0 -0
- data/spec/utopia/content/links/bar/parent/child/index.ja.xnode +0 -0
- data/spec/utopia/content/links/bar/parent/links.yaml +2 -0
- data/spec/utopia/content/links/index.xnode +0 -0
- data/spec/utopia/content/links/links.yaml +10 -1
- data/spec/utopia/content/links/redirect/links.yaml +2 -0
- data/spec/utopia/content/links_spec.rb +160 -43
- data/spec/utopia/content/localized/links.yaml +2 -5
- data/spec/utopia/content/node_spec.rb +1 -1
- data/spec/utopia/path_spec.rb +50 -5
- data/wiki/Gemfile +9 -0
- data/wiki/config.ru +7 -0
- data/{documentation/pages/wiki/development-environment-setup/content.md → wiki/pages/development-environment-setup/index.md} +0 -0
- data/wiki/pages/faq/links.yaml +2 -0
- data/{documentation/pages/wiki/faq/what-is-xnode/content.md → wiki/pages/faq/what-is-xnode/index.md} +1 -1
- data/wiki/pages/faq/what-is-xnode/links.yaml +2 -0
- data/{documentation/pages/wiki/content.md → wiki/pages/index.md} +2 -2
- data/{documentation/pages/wiki/javascript/content.md → wiki/pages/javascript/index.md} +15 -13
- data/wiki/pages/javascript/links.yaml +2 -0
- data/wiki/pages/links.yaml +2 -0
- data/{documentation/pages/wiki/middleware/content/content.md → wiki/pages/middleware/content/index.md} +0 -0
- data/{documentation/pages/wiki/middleware/controller/actions/content.md → wiki/pages/middleware/controller/actions/index.md} +2 -2
- data/{documentation/pages/wiki/middleware/controller/content.md → wiki/pages/middleware/controller/index.md} +0 -0
- data/{documentation/pages/wiki → wiki/pages}/middleware/controller/links.yaml +0 -0
- data/{documentation/pages/wiki/middleware/controller/rewrite/content.md → wiki/pages/middleware/controller/rewrite/index.md} +0 -0
- data/{documentation/pages/wiki/middleware/localization/content.md → wiki/pages/middleware/localization/index.md} +0 -0
- data/{documentation/pages/wiki/middleware/redirection/content.md → wiki/pages/middleware/redirection/index.md} +0 -0
- data/{documentation/pages/wiki/middleware/session/content.md → wiki/pages/middleware/session/index.md} +0 -0
- data/{documentation/pages/wiki/middleware/static/content.md → wiki/pages/middleware/static/index.md} +0 -0
- data/{documentation/pages/wiki/server-setup/content.md → wiki/pages/server-setup/index.md} +0 -0
- data/{documentation/pages/wiki/testing/content.md → wiki/pages/testing/index.md} +0 -0
- data/{documentation/pages/wiki/updating-utopia/content.md → wiki/pages/updating-utopia/index.md} +0 -0
- data/{documentation/pages/wiki/your-first-page/content.md → wiki/pages/your-first-page/index.md} +2 -2
- metadata +56 -263
- data/.travis.yml +0 -28
- data/Rakefile +0 -33
- data/docs/_components/jquery/core.js +0 -482
- data/docs/_static/utopia-background.svg +0 -1
- data/docs/_static/utopia.svg +0 -1
- data/docs/code/Utopia.html +0 -517
- data/docs/code/Utopia/Basename.html +0 -654
- data/docs/code/Utopia/Bootstrap.html +0 -538
- data/docs/code/Utopia/Command.html +0 -213
- data/docs/code/Utopia/Command/Environment.html +0 -321
- data/docs/code/Utopia/Command/Server.html +0 -214
- data/docs/code/Utopia/Command/Server/Create.html +0 -222
- data/docs/code/Utopia/Command/Server/Environment.html +0 -236
- data/docs/code/Utopia/Command/Server/Update.html +0 -317
- data/docs/code/Utopia/Command/Setup.html +0 -145
- data/docs/code/Utopia/Command/Setup/Server.html +0 -298
- data/docs/code/Utopia/Command/Setup/Site.html +0 -180
- data/docs/code/Utopia/Command/Site.html +0 -285
- data/docs/code/Utopia/Command/Site/Create.html +0 -324
- data/docs/code/Utopia/Command/Site/Update.html +0 -407
- data/docs/code/Utopia/Command/Top.html +0 -279
- data/docs/code/Utopia/Content.html +0 -832
- data/docs/code/Utopia/Content/Document.html +0 -1822
- data/docs/code/Utopia/Content/Document/State.html +0 -1220
- data/docs/code/Utopia/Content/Link.html +0 -1286
- data/docs/code/Utopia/Content/Links.html +0 -847
- data/docs/code/Utopia/Content/MarkupParser.html +0 -881
- data/docs/code/Utopia/Content/MarkupParser/ParsedTag.html +0 -422
- data/docs/code/Utopia/Content/MarkupParser/UnbalancedTagError.html +0 -615
- data/docs/code/Utopia/Content/Namespace.html +0 -485
- data/docs/code/Utopia/Content/Node.html +0 -1188
- data/docs/code/Utopia/Content/Node/Context.html +0 -938
- data/docs/code/Utopia/Content/Response.html +0 -813
- data/docs/code/Utopia/Content/SymbolicHash.html +0 -419
- data/docs/code/Utopia/Content/Tag.html +0 -399
- data/docs/code/Utopia/Content/Tags.html +0 -136
- data/docs/code/Utopia/Content/Tags/ContentTag.html +0 -187
- data/docs/code/Utopia/Content/Tags/DeferredTag.html +0 -193
- data/docs/code/Utopia/Content/Tags/Library.html +0 -333
- data/docs/code/Utopia/Content/Tags/NodeTag.html +0 -193
- data/docs/code/Utopia/Content/UnbalancedTagError.html +0 -298
- data/docs/code/Utopia/ContentLength.html +0 -343
- data/docs/code/Utopia/Controller.html +0 -907
- data/docs/code/Utopia/Controller/Actions.html +0 -289
- data/docs/code/Utopia/Controller/Actions/Action.html +0 -984
- data/docs/code/Utopia/Controller/Actions/ClassMethods.html +0 -442
- data/docs/code/Utopia/Controller/Base.html +0 -1216
- data/docs/code/Utopia/Controller/Respond.html +0 -293
- data/docs/code/Utopia/Controller/Respond/ClassMethods.html +0 -236
- data/docs/code/Utopia/Controller/Respond/Converter.html +0 -256
- data/docs/code/Utopia/Controller/Respond/Converter/Callback.html +0 -484
- data/docs/code/Utopia/Controller/Respond/Converter/ToJSON.html +0 -381
- data/docs/code/Utopia/Controller/Respond/Passthrough.html +0 -297
- data/docs/code/Utopia/Controller/Respond/Responder.html +0 -535
- data/docs/code/Utopia/Controller/Rewrite.html +0 -290
- data/docs/code/Utopia/Controller/Rewrite/ClassMethods.html +0 -242
- data/docs/code/Utopia/Controller/Rewrite/ExtractPrefixRule.html +0 -364
- data/docs/code/Utopia/Controller/Rewrite/Rewriter.html +0 -464
- data/docs/code/Utopia/Controller/Rewrite/Rule.html +0 -209
- data/docs/code/Utopia/Controller/Variables.html +0 -550
- data/docs/code/Utopia/Controllers.html +0 -244
- data/docs/code/Utopia/Exceptions.html +0 -127
- data/docs/code/Utopia/Exceptions/Handler.html +0 -526
- data/docs/code/Utopia/Exceptions/Mailer.html +0 -482
- data/docs/code/Utopia/Extensions.html +0 -117
- data/docs/code/Utopia/Extensions/ArraySplit.html +0 -183
- data/docs/code/Utopia/Extensions/DateTimeComparison.html +0 -193
- data/docs/code/Utopia/Extensions/TimeDateComparison.html +0 -193
- data/docs/code/Utopia/HTTP.html +0 -250
- data/docs/code/Utopia/HTTP/Status.html +0 -415
- data/docs/code/Utopia/Locale.html +0 -606
- data/docs/code/Utopia/Localization.html +0 -1241
- data/docs/code/Utopia/Localization/Wrapper.html +0 -459
- data/docs/code/Utopia/Logger.html +0 -205
- data/docs/code/Utopia/Logger/CompactFormatter.html +0 -335
- data/docs/code/Utopia/Path.html +0 -3310
- data/docs/code/Utopia/Path/Matcher.html +0 -518
- data/docs/code/Utopia/Path/Matcher/MatchData.html +0 -475
- data/docs/code/Utopia/Redirection.html +0 -151
- data/docs/code/Utopia/Redirection/ClientRedirect.html +0 -717
- data/docs/code/Utopia/Redirection/DirectoryIndex.html +0 -298
- data/docs/code/Utopia/Redirection/Errors.html +0 -476
- data/docs/code/Utopia/Redirection/Moved.html +0 -312
- data/docs/code/Utopia/Redirection/RequestFailure.html +0 -226
- data/docs/code/Utopia/Redirection/Rewrite.html +0 -296
- data/docs/code/Utopia/Session.html +0 -889
- data/docs/code/Utopia/Session/LazyHash.html +0 -859
- data/docs/code/Utopia/Setup.html +0 -970
- data/docs/code/Utopia/Static.html +0 -696
- data/docs/code/Utopia/Static/LocalFile.html +0 -1104
- data/docs/code/Utopia/Static/MimeTypeLoader.html +0 -541
- data/docs/code/Utopia/Static/MimeTypeLoader/ExpansionError.html +0 -124
- data/docs/code/Utopia/Tags.html +0 -115
- data/docs/code/Utopia/Tags/Environment.html +0 -314
- data/docs/code/Utopia/Tags/EnvironmentTag.html +0 -314
- data/docs/code/Utopia/Tags/Library.html +0 -340
- data/docs/code/_index.html +0 -758
- data/docs/code/class_list.html +0 -51
- data/docs/code/css/common.css +0 -1
- data/docs/code/css/full_list.css +0 -58
- data/docs/code/css/style.css +0 -496
- data/docs/code/file.README.html +0 -171
- data/docs/code/file_list.html +0 -56
- data/docs/code/frames.html +0 -17
- data/docs/code/index.html +0 -171
- data/docs/code/js/app.js +0 -292
- data/docs/code/js/full_list.js +0 -216
- data/docs/code/js/jquery.js +0 -4
- data/docs/code/materials/utopia.png +0 -0
- data/docs/code/materials/utopia.svg +0 -1
- data/docs/code/method_list.html +0 -3443
- data/docs/code/top-level-namespace.html +0 -110
- data/docs/wiki.html +0 -92
- data/docs/wiki/development-environment-setup/index.html +0 -60
- data/docs/wiki/edit.html +0 -103
- data/docs/wiki/faq/what-is-xnode/index.html +0 -79
- data/docs/wiki/javascript.html +0 -153
- data/docs/wiki/javascript/index.html +0 -153
- data/docs/wiki/middleware/content/index.html +0 -64
- data/docs/wiki/middleware/controller/actions/index.html +0 -117
- data/docs/wiki/middleware/controller/actions/rewrite/index.html +0 -48
- data/docs/wiki/middleware/controller/index.html +0 -104
- data/docs/wiki/middleware/controller/rewrite/index.html +0 -111
- data/docs/wiki/middleware/localization/index.html +0 -59
- data/docs/wiki/middleware/redirection/index.html +0 -61
- data/docs/wiki/middleware/session/index.html +0 -71
- data/docs/wiki/middleware/static/index.html +0 -57
- data/docs/wiki/server-setup/index.html +0 -118
- data/docs/wiki/testing/index.html +0 -59
- data/docs/wiki/updating-utopia/index.html +0 -108
- data/docs/wiki/your-first-page/index.html +0 -80
- data/documentation/.rspec +0 -4
- data/documentation/.yarnrc +0 -1
- data/documentation/Gemfile +0 -19
- data/documentation/Guardfile +0 -9
- data/documentation/Rakefile +0 -9
- data/documentation/config.ru +0 -41
- data/documentation/config/README.md +0 -7
- data/documentation/config/environment.rb +0 -12
- data/documentation/lib/readme.txt +0 -1
- data/documentation/pages/_editor.xnode +0 -64
- data/documentation/pages/_heading.xnode +0 -2
- data/documentation/pages/_page.xnode +0 -40
- data/documentation/pages/errors/exception.xnode +0 -5
- data/documentation/pages/errors/file-not-found.xnode +0 -5
- data/documentation/pages/links.yaml +0 -2
- data/documentation/pages/wiki/_listing.xnode +0 -32
- data/documentation/pages/wiki/_navigation.xnode +0 -15
- data/documentation/pages/wiki/controller.rb +0 -48
- data/documentation/pages/wiki/edit.xnode +0 -10
- data/documentation/pages/wiki/links.yaml +0 -6
- data/documentation/pages/wiki/show.xnode +0 -12
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.apache.css +0 -6
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.applescript.css +0 -5
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.assembly.css +0 -8
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.bash-script.css +0 -6
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.bash.css +0 -10
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.clang.css +0 -3
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.css.css +0 -14
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.diff.css +0 -16
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.html.css +0 -5
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.ocaml.css +0 -3
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.protobuf.css +0 -2
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.python.css +0 -6
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.ruby.css +0 -2
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.brush.xml.css +0 -18
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.core.css +0 -62
- data/documentation/public/_components/jquery-syntax/base/jquery.syntax.editor.css +0 -6
- data/documentation/public/_components/jquery-syntax/base/theme.js +0 -1
- data/documentation/public/_components/jquery-syntax/bright/jquery.syntax.core.css +0 -27
- data/documentation/public/_components/jquery-syntax/bright/theme.js +0 -1
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.apache.js +0 -41
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.applescript.js +0 -57
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.assembly.js +0 -37
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.bash-script.js +0 -67
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.bash.js +0 -33
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.basic.js +0 -51
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.clang.js +0 -89
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.csharp.js +0 -47
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.css.js +0 -80
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.diff.js +0 -24
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.go.js +0 -47
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.haskell.js +0 -45
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.html.js +0 -66
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.io.js +0 -45
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.java.js +0 -45
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.javascript.js +0 -40
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.kai.js +0 -29
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.lisp.js +0 -34
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.lua.js +0 -44
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.nginx.js +0 -31
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.ocaml.js +0 -73
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.ooc.js +0 -46
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.pascal.js +0 -51
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.perl5.js +0 -52
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.php-script.js +0 -48
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.php.js +0 -15
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.plain.js +0 -10
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.protobuf.js +0 -43
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.python.js +0 -44
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.ruby.js +0 -77
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.scala.js +0 -44
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.smalltalk.js +0 -29
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.sql.js +0 -31
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.super-collider.js +0 -57
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.swift.js +0 -55
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.trenni.js +0 -35
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.xml.js +0 -50
- data/documentation/public/_components/jquery-syntax/jquery.syntax.brush.yaml.js +0 -29
- data/documentation/public/_components/jquery-syntax/jquery.syntax.cache.js +0 -65
- data/documentation/public/_components/jquery-syntax/jquery.syntax.core.js +0 -1098
- data/documentation/public/_components/jquery-syntax/jquery.syntax.editor.js +0 -291
- data/documentation/public/_components/jquery-syntax/jquery.syntax.js +0 -258
- data/documentation/public/_components/jquery-syntax/jquery.syntax.min.js +0 -13
- data/documentation/public/_components/jquery-syntax/paper/jquery.syntax.core.css +0 -31
- data/documentation/public/_components/jquery-syntax/paper/theme.js +0 -1
- data/documentation/public/_components/jquery/core.js +0 -482
- data/documentation/public/_components/jquery/jquery.js +0 -10220
- data/documentation/public/_components/jquery/jquery.min.js +0 -4
- data/documentation/public/_components/jquery/jquery.min.map +0 -1
- data/documentation/public/_components/jquery/jquery.slim.js +0 -8107
- data/documentation/public/_components/jquery/jquery.slim.min.js +0 -4
- data/documentation/public/_components/jquery/jquery.slim.min.map +0 -1
- data/documentation/public/_static +0 -1
- data/documentation/public/materials +0 -1
- data/documentation/spec/website_context.rb +0 -12
- data/documentation/spec/website_spec.rb +0 -16
- data/documentation/tasks +0 -1
- data/spec/utopia/content/link_spec.rb +0 -47
@@ -1,1241 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
Class: Utopia::Localization
|
8
|
-
|
9
|
-
— Documentation by YARD 0.9.18
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
pathId = "Utopia::Localization";
|
19
|
-
relpath = '../';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="../_index.html">Index (L)</a> »
|
40
|
-
<span class='title'><span class='object_link'><a href="../Utopia.html" title="Utopia (module)">Utopia</a></span></span>
|
41
|
-
»
|
42
|
-
<span class="title">Localization</span>
|
43
|
-
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<div id="search">
|
47
|
-
|
48
|
-
<a class="full_list_link" id="class_list_link"
|
49
|
-
href="../class_list.html">
|
50
|
-
|
51
|
-
<svg width="24" height="24">
|
52
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
-
</svg>
|
56
|
-
</a>
|
57
|
-
|
58
|
-
</div>
|
59
|
-
<div class="clear"></div>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<div id="content"><h1>Class: Utopia::Localization
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
</h1>
|
67
|
-
<div class="box_info">
|
68
|
-
|
69
|
-
<dl>
|
70
|
-
<dt>Inherits:</dt>
|
71
|
-
<dd>
|
72
|
-
<span class="inheritName">Object</span>
|
73
|
-
|
74
|
-
<ul class="fullTree">
|
75
|
-
<li>Object</li>
|
76
|
-
|
77
|
-
<li class="next">Utopia::Localization</li>
|
78
|
-
|
79
|
-
</ul>
|
80
|
-
<a href="#" class="inheritanceTree">show all</a>
|
81
|
-
|
82
|
-
</dd>
|
83
|
-
</dl>
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
<dl>
|
96
|
-
<dt>Defined in:</dt>
|
97
|
-
<dd>lib/utopia/localization.rb</dd>
|
98
|
-
</dl>
|
99
|
-
|
100
|
-
</div>
|
101
|
-
|
102
|
-
<h2>Overview</h2><div class="docstring">
|
103
|
-
<div class="discussion">
|
104
|
-
<p>A middleware which attempts to find localized content.</p>
|
105
|
-
|
106
|
-
|
107
|
-
</div>
|
108
|
-
</div>
|
109
|
-
<div class="tags">
|
110
|
-
|
111
|
-
|
112
|
-
</div><h2>Defined Under Namespace</h2>
|
113
|
-
<p class="children">
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Localization/Wrapper.html" title="Utopia::Localization::Wrapper (class)">Wrapper</a></span>
|
119
|
-
|
120
|
-
|
121
|
-
</p>
|
122
|
-
|
123
|
-
|
124
|
-
<h2>
|
125
|
-
Constant Summary
|
126
|
-
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
127
|
-
</h2>
|
128
|
-
|
129
|
-
<dl class="constants">
|
130
|
-
|
131
|
-
<dt id="RESOURCE_NOT_FOUND-constant" class="">RESOURCE_NOT_FOUND =
|
132
|
-
|
133
|
-
</dt>
|
134
|
-
<dd><pre class="code"><span class='lbracket'>[</span><span class='int'>400</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
135
|
-
|
136
|
-
<dt id="HTTP_ACCEPT_LANGUAGE-constant" class="">HTTP_ACCEPT_LANGUAGE =
|
137
|
-
|
138
|
-
</dt>
|
139
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>HTTP_ACCEPT_LANGUAGE</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
140
|
-
|
141
|
-
<dt id="LOCALIZATION_KEY-constant" class="">LOCALIZATION_KEY =
|
142
|
-
|
143
|
-
</dt>
|
144
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>utopia.localization</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
145
|
-
|
146
|
-
<dt id="CURRENT_LOCALE_KEY-constant" class="">CURRENT_LOCALE_KEY =
|
147
|
-
|
148
|
-
</dt>
|
149
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>utopia.localization.current_locale</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
150
|
-
|
151
|
-
<dt id="SAFE_METHODS-constant" class="">SAFE_METHODS =
|
152
|
-
|
153
|
-
</dt>
|
154
|
-
<dd><pre class="code"><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>GET</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>HEAD</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span></pre></dd>
|
155
|
-
|
156
|
-
</dl>
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
163
|
-
<ul class="summary">
|
164
|
-
|
165
|
-
<li class="public ">
|
166
|
-
<span class="summary_signature">
|
167
|
-
|
168
|
-
<a href="#all_locales-instance_method" title="#all_locales (instance method)">#<strong>all_locales</strong> ⇒ Object </a>
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
</span>
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
<span class="note title readonly">readonly</span>
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute all_locales.</p>
|
188
|
-
</div></span>
|
189
|
-
|
190
|
-
</li>
|
191
|
-
|
192
|
-
|
193
|
-
<li class="public ">
|
194
|
-
<span class="summary_signature">
|
195
|
-
|
196
|
-
<a href="#default_locale-instance_method" title="#default_locale (instance method)">#<strong>default_locale</strong> ⇒ Object </a>
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
</span>
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
<span class="note title readonly">readonly</span>
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute default_locale.</p>
|
216
|
-
</div></span>
|
217
|
-
|
218
|
-
</li>
|
219
|
-
|
220
|
-
|
221
|
-
</ul>
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
<h2>
|
228
|
-
Class Method Summary
|
229
|
-
<small><a href="#" class="summary_toggle">collapse</a></small>
|
230
|
-
</h2>
|
231
|
-
|
232
|
-
<ul class="summary">
|
233
|
-
|
234
|
-
<li class="public ">
|
235
|
-
<span class="summary_signature">
|
236
|
-
|
237
|
-
<a href="#[]-class_method" title="[] (class method)">.<strong>[]</strong>(request) ⇒ Object </a>
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
</span>
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
<span class="summary_desc"><div class='inline'>
|
252
|
-
</div></span>
|
253
|
-
|
254
|
-
</li>
|
255
|
-
|
256
|
-
|
257
|
-
</ul>
|
258
|
-
|
259
|
-
<h2>
|
260
|
-
Instance Method Summary
|
261
|
-
<small><a href="#" class="summary_toggle">collapse</a></small>
|
262
|
-
</h2>
|
263
|
-
|
264
|
-
<ul class="summary">
|
265
|
-
|
266
|
-
<li class="public ">
|
267
|
-
<span class="summary_signature">
|
268
|
-
|
269
|
-
<a href="#browser_preferred_locales-instance_method" title="#browser_preferred_locales (instance method)">#<strong>browser_preferred_locales</strong>(env) ⇒ Object </a>
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
</span>
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
<span class="summary_desc"><div class='inline'>
|
284
|
-
</div></span>
|
285
|
-
|
286
|
-
</li>
|
287
|
-
|
288
|
-
|
289
|
-
<li class="public ">
|
290
|
-
<span class="summary_signature">
|
291
|
-
|
292
|
-
<a href="#call-instance_method" title="#call (instance method)">#<strong>call</strong>(env) ⇒ Object </a>
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
</span>
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
<span class="summary_desc"><div class='inline'>
|
307
|
-
</div></span>
|
308
|
-
|
309
|
-
</li>
|
310
|
-
|
311
|
-
|
312
|
-
<li class="public ">
|
313
|
-
<span class="summary_signature">
|
314
|
-
|
315
|
-
<a href="#freeze-instance_method" title="#freeze (instance method)">#<strong>freeze</strong> ⇒ Object </a>
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
</span>
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
<span class="summary_desc"><div class='inline'>
|
330
|
-
</div></span>
|
331
|
-
|
332
|
-
</li>
|
333
|
-
|
334
|
-
|
335
|
-
<li class="public ">
|
336
|
-
<span class="summary_signature">
|
337
|
-
|
338
|
-
<a href="#host_preferred_locales-instance_method" title="#host_preferred_locales (instance method)">#<strong>host_preferred_locales</strong>(env) ⇒ Object </a>
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
</span>
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
<span class="summary_desc"><div class='inline'>
|
353
|
-
</div></span>
|
354
|
-
|
355
|
-
</li>
|
356
|
-
|
357
|
-
|
358
|
-
<li class="public ">
|
359
|
-
<span class="summary_signature">
|
360
|
-
|
361
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(app, locales:, default_locale: nil, default_locales: nil, hosts: {}, ignore: [], **options) ⇒ Localization </a>
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
</span>
|
366
|
-
|
367
|
-
|
368
|
-
<span class="note title constructor">constructor</span>
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
<span class="summary_desc"><div class='inline'><p>A new instance of Localization.</p>
|
378
|
-
</div></span>
|
379
|
-
|
380
|
-
</li>
|
381
|
-
|
382
|
-
|
383
|
-
<li class="public ">
|
384
|
-
<span class="summary_signature">
|
385
|
-
|
386
|
-
<a href="#localized%3F-instance_method" title="#localized? (instance method)">#<strong>localized?</strong>(env) ⇒ Boolean </a>
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
</span>
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
<span class="summary_desc"><div class='inline'>
|
401
|
-
</div></span>
|
402
|
-
|
403
|
-
</li>
|
404
|
-
|
405
|
-
|
406
|
-
<li class="public ">
|
407
|
-
<span class="summary_signature">
|
408
|
-
|
409
|
-
<a href="#preferred_locales-instance_method" title="#preferred_locales (instance method)">#<strong>preferred_locales</strong>(env) ⇒ Object </a>
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
</span>
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
<span class="summary_desc"><div class='inline'>
|
424
|
-
</div></span>
|
425
|
-
|
426
|
-
</li>
|
427
|
-
|
428
|
-
|
429
|
-
<li class="public ">
|
430
|
-
<span class="summary_signature">
|
431
|
-
|
432
|
-
<a href="#request_preferred_locale-instance_method" title="#request_preferred_locale (instance method)">#<strong>request_preferred_locale</strong>(env) ⇒ Object </a>
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
</span>
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
<span class="summary_desc"><div class='inline'>
|
447
|
-
</div></span>
|
448
|
-
|
449
|
-
</li>
|
450
|
-
|
451
|
-
|
452
|
-
<li class="public ">
|
453
|
-
<span class="summary_signature">
|
454
|
-
|
455
|
-
<a href="#vary-instance_method" title="#vary (instance method)">#<strong>vary</strong>(env, response) ⇒ Object </a>
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
</span>
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
<span class="summary_desc"><div class='inline'><p>Set the Vary: header on the response to indicate that this response should include the header in the cache key.</p>
|
470
|
-
</div></span>
|
471
|
-
|
472
|
-
</li>
|
473
|
-
|
474
|
-
|
475
|
-
</ul>
|
476
|
-
|
477
|
-
|
478
|
-
<div id="constructor_details" class="method_details_list">
|
479
|
-
<h2>Constructor Details</h2>
|
480
|
-
|
481
|
-
<div class="method_details first">
|
482
|
-
<h3 class="signature first" id="initialize-instance_method">
|
483
|
-
|
484
|
-
#<strong>initialize</strong>(app, locales:, default_locale: nil, default_locales: nil, hosts: {}, ignore: [], **options) ⇒ <tt><span class='object_link'><a href="" title="Utopia::Localization (class)">Localization</a></span></tt>
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
</h3><div class="docstring">
|
491
|
-
<div class="discussion">
|
492
|
-
<p>Returns a new instance of Localization</p>
|
493
|
-
|
494
|
-
|
495
|
-
</div>
|
496
|
-
</div>
|
497
|
-
<div class="tags">
|
498
|
-
<p class="tag_title">Parameters:</p>
|
499
|
-
<ul class="param">
|
500
|
-
|
501
|
-
<li>
|
502
|
-
|
503
|
-
<span class='name'>locales</span>
|
504
|
-
|
505
|
-
|
506
|
-
<span class='type'>(<tt>Array<String></tt>)</span>
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
—
|
511
|
-
<div class='inline'><p>An array of all supported locales.</p>
|
512
|
-
</div>
|
513
|
-
|
514
|
-
</li>
|
515
|
-
|
516
|
-
<li>
|
517
|
-
|
518
|
-
<span class='name'>default_locale</span>
|
519
|
-
|
520
|
-
|
521
|
-
<span class='type'>(<tt>String</tt>)</span>
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
—
|
526
|
-
<div class='inline'><p>The default locale if none is provided.</p>
|
527
|
-
</div>
|
528
|
-
|
529
|
-
</li>
|
530
|
-
|
531
|
-
<li>
|
532
|
-
|
533
|
-
<span class='name'>default_locales</span>
|
534
|
-
|
535
|
-
|
536
|
-
<span class='type'>(<tt>String</tt>)</span>
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
—
|
541
|
-
<div class='inline'><p>The locales to try in order if none is provided.</p>
|
542
|
-
</div>
|
543
|
-
|
544
|
-
</li>
|
545
|
-
|
546
|
-
<li>
|
547
|
-
|
548
|
-
<span class='name'>hosts</span>
|
549
|
-
|
550
|
-
|
551
|
-
<span class='type'>(<tt>Hash<Pattern, String></tt>)</span>
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
—
|
556
|
-
<div class='inline'><p>Specify a mapping of the HTTP_HOST header to a given locale.</p>
|
557
|
-
</div>
|
558
|
-
|
559
|
-
</li>
|
560
|
-
|
561
|
-
<li>
|
562
|
-
|
563
|
-
<span class='name'>ignore</span>
|
564
|
-
|
565
|
-
|
566
|
-
<span class='type'>(<tt>Array<Pattern></tt>)</span>
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
—
|
571
|
-
<div class='inline'><p>A list of patterns matched against PATH_INFO which will not be localized.</p>
|
572
|
-
</div>
|
573
|
-
|
574
|
-
</li>
|
575
|
-
|
576
|
-
</ul>
|
577
|
-
|
578
|
-
|
579
|
-
</div><table class="source_code">
|
580
|
-
<tr>
|
581
|
-
<td>
|
582
|
-
<pre class="lines">
|
583
|
-
|
584
|
-
|
585
|
-
67
|
586
|
-
68
|
587
|
-
69
|
588
|
-
70
|
589
|
-
71
|
590
|
-
72
|
591
|
-
73
|
592
|
-
74
|
593
|
-
75
|
594
|
-
76
|
595
|
-
77
|
596
|
-
78
|
597
|
-
79
|
598
|
-
80
|
599
|
-
81
|
600
|
-
82
|
601
|
-
83
|
602
|
-
84
|
603
|
-
85
|
604
|
-
86
|
605
|
-
87
|
606
|
-
88</pre>
|
607
|
-
</td>
|
608
|
-
<td>
|
609
|
-
<pre class="code"><span class="info file"># File 'lib/utopia/localization.rb', line 67</span>
|
610
|
-
|
611
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_app'>app</span><span class='comma'>,</span> <span class='label'>locales:</span><span class='comma'>,</span> <span class='label'>default_locale:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>default_locales:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>hosts:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>ignore:</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
612
|
-
<span class='ivar'>@app</span> <span class='op'>=</span> <span class='id identifier rubyid_app'>app</span>
|
613
|
-
|
614
|
-
<span class='ivar'>@all_locales</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="HTTP.html" title="Utopia::HTTP (module)">HTTP</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="HTTP.html#Accept-constant" title="Utopia::HTTP::Accept (constant)">Accept</a></span></span><span class='op'>::</span><span class='const'>Languages</span><span class='op'>::</span><span class='const'>Locales</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_locales'>locales</span><span class='rparen'>)</span>
|
615
|
-
|
616
|
-
<span class='comment'># Locales here are represented as an array of strings, e.g. ['en', 'ja', 'cn', 'de'] and are used in order if no locale is specified by the user.
|
617
|
-
</span> <span class='kw'>unless</span> <span class='ivar'>@default_locales</span> <span class='op'>=</span> <span class='id identifier rubyid_default_locales'>default_locales</span>
|
618
|
-
<span class='comment'># We append nil, i.e. no localization.
|
619
|
-
</span> <span class='ivar'>@default_locales</span> <span class='op'>=</span> <span class='ivar'>@all_locales</span><span class='period'>.</span><span class='id identifier rubyid_names'>names</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='kw'>nil</span><span class='rbracket'>]</span>
|
620
|
-
<span class='kw'>end</span>
|
621
|
-
|
622
|
-
<span class='ivar'>@default_locale</span> <span class='op'>=</span> <span class='id identifier rubyid_default_locale'>default_locale</span> <span class='op'>||</span> <span class='ivar'>@default_locales</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
623
|
-
|
624
|
-
<span class='kw'>unless</span> <span class='ivar'>@default_locales</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='ivar'>@default_locale</span>
|
625
|
-
<span class='ivar'>@default_locales</span><span class='period'>.</span><span class='id identifier rubyid_unshift'>unshift</span><span class='lparen'>(</span><span class='ivar'>@default_locale</span><span class='rparen'>)</span>
|
626
|
-
<span class='kw'>end</span>
|
627
|
-
|
628
|
-
<span class='comment'># Select a localization based on a request host name:
|
629
|
-
</span> <span class='ivar'>@hosts</span> <span class='op'>=</span> <span class='id identifier rubyid_hosts'>hosts</span>
|
630
|
-
|
631
|
-
<span class='ivar'>@ignore</span> <span class='op'>=</span> <span class='id identifier rubyid_ignore'>ignore</span> <span class='op'>||</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:nonlocalized</span><span class='rbracket'>]</span>
|
632
|
-
<span class='kw'>end</span></pre>
|
633
|
-
</td>
|
634
|
-
</tr>
|
635
|
-
</table>
|
636
|
-
</div>
|
637
|
-
|
638
|
-
</div>
|
639
|
-
|
640
|
-
<div id="instance_attr_details" class="attr_details">
|
641
|
-
<h2>Instance Attribute Details</h2>
|
642
|
-
|
643
|
-
|
644
|
-
<span id=""></span>
|
645
|
-
<div class="method_details first">
|
646
|
-
<h3 class="signature first" id="all_locales-instance_method">
|
647
|
-
|
648
|
-
#<strong>all_locales</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
</h3><div class="docstring">
|
655
|
-
<div class="discussion">
|
656
|
-
<p>Returns the value of attribute all_locales</p>
|
657
|
-
|
658
|
-
|
659
|
-
</div>
|
660
|
-
</div>
|
661
|
-
<div class="tags">
|
662
|
-
|
663
|
-
|
664
|
-
</div><table class="source_code">
|
665
|
-
<tr>
|
666
|
-
<td>
|
667
|
-
<pre class="lines">
|
668
|
-
|
669
|
-
|
670
|
-
102
|
671
|
-
103
|
672
|
-
104</pre>
|
673
|
-
</td>
|
674
|
-
<td>
|
675
|
-
<pre class="code"><span class="info file"># File 'lib/utopia/localization.rb', line 102</span>
|
676
|
-
|
677
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_all_locales'>all_locales</span>
|
678
|
-
<span class='ivar'>@all_locales</span>
|
679
|
-
<span class='kw'>end</span></pre>
|
680
|
-
</td>
|
681
|
-
</tr>
|
682
|
-
</table>
|
683
|
-
</div>
|
684
|
-
|
685
|
-
|
686
|
-
<span id=""></span>
|
687
|
-
<div class="method_details ">
|
688
|
-
<h3 class="signature " id="default_locale-instance_method">
|
689
|
-
|
690
|
-
#<strong>default_locale</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
</h3><div class="docstring">
|
697
|
-
<div class="discussion">
|
698
|
-
<p>Returns the value of attribute default_locale</p>
|
699
|
-
|
700
|
-
|
701
|
-
</div>
|
702
|
-
</div>
|
703
|
-
<div class="tags">
|
704
|
-
|
705
|
-
|
706
|
-
</div><table class="source_code">
|
707
|
-
<tr>
|
708
|
-
<td>
|
709
|
-
<pre class="lines">
|
710
|
-
|
711
|
-
|
712
|
-
103
|
713
|
-
104
|
714
|
-
105</pre>
|
715
|
-
</td>
|
716
|
-
<td>
|
717
|
-
<pre class="code"><span class="info file"># File 'lib/utopia/localization.rb', line 103</span>
|
718
|
-
|
719
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_default_locale'>default_locale</span>
|
720
|
-
<span class='ivar'>@default_locale</span>
|
721
|
-
<span class='kw'>end</span></pre>
|
722
|
-
</td>
|
723
|
-
</tr>
|
724
|
-
</table>
|
725
|
-
</div>
|
726
|
-
|
727
|
-
</div>
|
728
|
-
|
729
|
-
|
730
|
-
<div id="class_method_details" class="method_details_list">
|
731
|
-
<h2>Class Method Details</h2>
|
732
|
-
|
733
|
-
|
734
|
-
<div class="method_details first">
|
735
|
-
<h3 class="signature first" id="[]-class_method">
|
736
|
-
|
737
|
-
.<strong>[]</strong>(request) ⇒ <tt>Object</tt>
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
</h3><table class="source_code">
|
744
|
-
<tr>
|
745
|
-
<td>
|
746
|
-
<pre class="lines">
|
747
|
-
|
748
|
-
|
749
|
-
52
|
750
|
-
53
|
751
|
-
54</pre>
|
752
|
-
</td>
|
753
|
-
<td>
|
754
|
-
<pre class="code"><span class="info file"># File 'lib/utopia/localization.rb', line 52</span>
|
755
|
-
|
756
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='op'>[]</span> <span class='id identifier rubyid_request'>request</span>
|
757
|
-
<span class='const'><span class='object_link'><a href="Localization/Wrapper.html" title="Utopia::Localization::Wrapper (class)">Wrapper</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Localization/Wrapper.html#initialize-instance_method" title="Utopia::Localization::Wrapper#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
758
|
-
<span class='kw'>end</span></pre>
|
759
|
-
</td>
|
760
|
-
</tr>
|
761
|
-
</table>
|
762
|
-
</div>
|
763
|
-
|
764
|
-
</div>
|
765
|
-
|
766
|
-
<div id="instance_method_details" class="method_details_list">
|
767
|
-
<h2>Instance Method Details</h2>
|
768
|
-
|
769
|
-
|
770
|
-
<div class="method_details first">
|
771
|
-
<h3 class="signature first" id="browser_preferred_locales-instance_method">
|
772
|
-
|
773
|
-
#<strong>browser_preferred_locales</strong>(env) ⇒ <tt>Object</tt>
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
</h3><table class="source_code">
|
780
|
-
<tr>
|
781
|
-
<td>
|
782
|
-
<pre class="lines">
|
783
|
-
|
784
|
-
|
785
|
-
151
|
786
|
-
152
|
787
|
-
153
|
788
|
-
154
|
789
|
-
155
|
790
|
-
156
|
791
|
-
157
|
792
|
-
158
|
793
|
-
159
|
794
|
-
160
|
795
|
-
161
|
796
|
-
162
|
797
|
-
163
|
798
|
-
164
|
799
|
-
165</pre>
|
800
|
-
</td>
|
801
|
-
<td>
|
802
|
-
<pre class="code"><span class="info file"># File 'lib/utopia/localization.rb', line 151</span>
|
803
|
-
|
804
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_browser_preferred_locales'>browser_preferred_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
805
|
-
<span class='id identifier rubyid_accept_languages'>accept_languages</span> <span class='op'>=</span> <span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="#HTTP_ACCEPT_LANGUAGE-constant" title="Utopia::Localization::HTTP_ACCEPT_LANGUAGE (constant)">HTTP_ACCEPT_LANGUAGE</a></span></span><span class='rbracket'>]</span>
|
806
|
-
|
807
|
-
<span class='comment'># No user prefered languages:
|
808
|
-
</span> <span class='kw'>return</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_accept_languages'>accept_languages</span>
|
809
|
-
|
810
|
-
<span class='comment'># Extract the ordered list of languages:
|
811
|
-
</span> <span class='id identifier rubyid_languages'>languages</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="HTTP.html" title="Utopia::HTTP (module)">HTTP</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="HTTP.html#Accept-constant" title="Utopia::HTTP::Accept (constant)">Accept</a></span></span><span class='op'>::</span><span class='const'>Languages</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_accept_languages'>accept_languages</span><span class='rparen'>)</span>
|
812
|
-
|
813
|
-
<span class='comment'># Returns available languages based on the order languages:
|
814
|
-
</span> <span class='kw'>return</span> <span class='ivar'>@all_locales</span> <span class='op'>&</span> <span class='id identifier rubyid_languages'>languages</span>
|
815
|
-
<span class='kw'>rescue</span> <span class='const'><span class='object_link'><a href="HTTP.html" title="Utopia::HTTP (module)">HTTP</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="HTTP.html#Accept-constant" title="Utopia::HTTP::Accept (constant)">Accept</a></span></span><span class='op'>::</span><span class='const'>ParseError</span>
|
816
|
-
<span class='comment'># If we fail to parse the browser Accept-Language header, we ignore it (silently).
|
817
|
-
</span> <span class='kw'>return</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
818
|
-
<span class='kw'>end</span></pre>
|
819
|
-
</td>
|
820
|
-
</tr>
|
821
|
-
</table>
|
822
|
-
</div>
|
823
|
-
|
824
|
-
<div class="method_details ">
|
825
|
-
<h3 class="signature " id="call-instance_method">
|
826
|
-
|
827
|
-
#<strong>call</strong>(env) ⇒ <tt>Object</tt>
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
</h3><table class="source_code">
|
834
|
-
<tr>
|
835
|
-
<td>
|
836
|
-
<pre class="lines">
|
837
|
-
|
838
|
-
|
839
|
-
201
|
840
|
-
202
|
841
|
-
203
|
842
|
-
204
|
843
|
-
205
|
844
|
-
206
|
845
|
-
207
|
846
|
-
208
|
847
|
-
209
|
848
|
-
210
|
849
|
-
211
|
850
|
-
212
|
851
|
-
213
|
852
|
-
214
|
853
|
-
215
|
854
|
-
216
|
855
|
-
217
|
856
|
-
218
|
857
|
-
219</pre>
|
858
|
-
</td>
|
859
|
-
<td>
|
860
|
-
<pre class="code"><span class="info file"># File 'lib/utopia/localization.rb', line 201</span>
|
861
|
-
|
862
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
863
|
-
<span class='comment'># Pass the request through if it shouldn't be localized:
|
864
|
-
</span> <span class='kw'>return</span> <span class='ivar'>@app</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_localized?'>localized?</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
865
|
-
|
866
|
-
<span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="#LOCALIZATION_KEY-constant" title="Utopia::Localization::LOCALIZATION_KEY (constant)">LOCALIZATION_KEY</a></span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span>
|
867
|
-
|
868
|
-
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
869
|
-
|
870
|
-
<span class='comment'># We have a non-localized request, but there might be a localized resource. We return the best localization possible:
|
871
|
-
</span> <span class='id identifier rubyid_preferred_locales'>preferred_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_localized_env'>localized_env</span><span class='op'>|</span>
|
872
|
-
<span class='comment'># puts "Trying locale: #{env[CURRENT_LOCALE_KEY]}: #{env[Rack::PATH_INFO]}..."
|
873
|
-
</span>
|
874
|
-
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='ivar'>@app</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_localized_env'>localized_env</span><span class='rparen'>)</span>
|
875
|
-
|
876
|
-
<span class='kw'>break</span> <span class='kw'>unless</span> <span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>>=</span> <span class='int'>400</span>
|
877
|
-
<span class='kw'>end</span>
|
878
|
-
|
879
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_vary'>vary</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='comma'>,</span> <span class='id identifier rubyid_response'>response</span><span class='rparen'>)</span>
|
880
|
-
<span class='kw'>end</span></pre>
|
881
|
-
</td>
|
882
|
-
</tr>
|
883
|
-
</table>
|
884
|
-
</div>
|
885
|
-
|
886
|
-
<div class="method_details ">
|
887
|
-
<h3 class="signature " id="freeze-instance_method">
|
888
|
-
|
889
|
-
#<strong>freeze</strong> ⇒ <tt>Object</tt>
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
</h3><table class="source_code">
|
896
|
-
<tr>
|
897
|
-
<td>
|
898
|
-
<pre class="lines">
|
899
|
-
|
900
|
-
|
901
|
-
90
|
902
|
-
91
|
903
|
-
92
|
904
|
-
93
|
905
|
-
94
|
906
|
-
95
|
907
|
-
96
|
908
|
-
97
|
909
|
-
98
|
910
|
-
99
|
911
|
-
100</pre>
|
912
|
-
</td>
|
913
|
-
<td>
|
914
|
-
<pre class="code"><span class="info file"># File 'lib/utopia/localization.rb', line 90</span>
|
915
|
-
|
916
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_freeze'>freeze</span>
|
917
|
-
<span class='kw'>return</span> <span class='kw'>self</span> <span class='kw'>if</span> <span class='id identifier rubyid_frozen?'>frozen?</span>
|
918
|
-
|
919
|
-
<span class='ivar'>@all_locales</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
|
920
|
-
<span class='ivar'>@default_locales</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
|
921
|
-
<span class='ivar'>@default_locale</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
|
922
|
-
<span class='ivar'>@hosts</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
|
923
|
-
<span class='ivar'>@ignore</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
|
924
|
-
|
925
|
-
<span class='kw'>super</span>
|
926
|
-
<span class='kw'>end</span></pre>
|
927
|
-
</td>
|
928
|
-
</tr>
|
929
|
-
</table>
|
930
|
-
</div>
|
931
|
-
|
932
|
-
<div class="method_details ">
|
933
|
-
<h3 class="signature " id="host_preferred_locales-instance_method">
|
934
|
-
|
935
|
-
#<strong>host_preferred_locales</strong>(env) ⇒ <tt>Object</tt>
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
</h3><table class="source_code">
|
942
|
-
<tr>
|
943
|
-
<td>
|
944
|
-
<pre class="lines">
|
945
|
-
|
946
|
-
|
947
|
-
131
|
948
|
-
132
|
949
|
-
133
|
950
|
-
134
|
951
|
-
135
|
952
|
-
136
|
953
|
-
137
|
954
|
-
138</pre>
|
955
|
-
</td>
|
956
|
-
<td>
|
957
|
-
<pre class="code"><span class="info file"># File 'lib/utopia/localization.rb', line 131</span>
|
958
|
-
|
959
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_host_preferred_locales'>host_preferred_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
960
|
-
<span class='id identifier rubyid_http_host'>http_host</span> <span class='op'>=</span> <span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='const'>Rack</span><span class='op'>::</span><span class='const'>HTTP_HOST</span><span class='rbracket'>]</span>
|
961
|
-
|
962
|
-
<span class='comment'># Yield all hosts which match the incoming http_host:
|
963
|
-
</span> <span class='ivar'>@hosts</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_pattern'>pattern</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='op'>|</span>
|
964
|
-
<span class='kw'>yield</span> <span class='id identifier rubyid_locale'>locale</span> <span class='kw'>if</span> <span class='id identifier rubyid_http_host'>http_host</span><span class='lbracket'>[</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rbracket'>]</span>
|
965
|
-
<span class='kw'>end</span>
|
966
|
-
<span class='kw'>end</span></pre>
|
967
|
-
</td>
|
968
|
-
</tr>
|
969
|
-
</table>
|
970
|
-
</div>
|
971
|
-
|
972
|
-
<div class="method_details ">
|
973
|
-
<h3 class="signature " id="localized?-instance_method">
|
974
|
-
|
975
|
-
#<strong>localized?</strong>(env) ⇒ <tt>Boolean</tt>
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
</h3><div class="docstring">
|
982
|
-
<div class="discussion">
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
</div>
|
987
|
-
</div>
|
988
|
-
<div class="tags">
|
989
|
-
|
990
|
-
<p class="tag_title">Returns:</p>
|
991
|
-
<ul class="return">
|
992
|
-
|
993
|
-
<li>
|
994
|
-
|
995
|
-
|
996
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
</li>
|
1001
|
-
|
1002
|
-
</ul>
|
1003
|
-
|
1004
|
-
</div><table class="source_code">
|
1005
|
-
<tr>
|
1006
|
-
<td>
|
1007
|
-
<pre class="lines">
|
1008
|
-
|
1009
|
-
|
1010
|
-
169
|
1011
|
-
170
|
1012
|
-
171
|
1013
|
-
172
|
1014
|
-
173
|
1015
|
-
174
|
1016
|
-
175
|
1017
|
-
176
|
1018
|
-
177
|
1019
|
-
178
|
1020
|
-
179</pre>
|
1021
|
-
</td>
|
1022
|
-
<td>
|
1023
|
-
<pre class="code"><span class="info file"># File 'lib/utopia/localization.rb', line 169</span>
|
1024
|
-
|
1025
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_localized?'>localized?</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
1026
|
-
<span class='comment'># Only SAFE_METHODS can be localized:
|
1027
|
-
</span> <span class='id identifier rubyid_request_method'>request_method</span> <span class='op'>=</span> <span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='const'>Rack</span><span class='op'>::</span><span class='const'>REQUEST_METHOD</span><span class='rbracket'>]</span>
|
1028
|
-
<span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='const'><span class='object_link'><a href="#SAFE_METHODS-constant" title="Utopia::Localization::SAFE_METHODS (constant)">SAFE_METHODS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_request_method'>request_method</span><span class='rparen'>)</span>
|
1029
|
-
|
1030
|
-
<span class='comment'># Ignore requests which match the ignored paths:
|
1031
|
-
</span> <span class='id identifier rubyid_path_info'>path_info</span> <span class='op'>=</span> <span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='const'>Rack</span><span class='op'>::</span><span class='const'>PATH_INFO</span><span class='rbracket'>]</span>
|
1032
|
-
<span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='ivar'>@ignore</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_pattern'>pattern</span><span class='op'>|</span> <span class='id identifier rubyid_path_info'>path_info</span><span class='lbracket'>[</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rbracket'>]</span> <span class='op'>!=</span> <span class='kw'>nil</span> <span class='rbrace'>}</span>
|
1033
|
-
|
1034
|
-
<span class='kw'>return</span> <span class='kw'>true</span>
|
1035
|
-
<span class='kw'>end</span></pre>
|
1036
|
-
</td>
|
1037
|
-
</tr>
|
1038
|
-
</table>
|
1039
|
-
</div>
|
1040
|
-
|
1041
|
-
<div class="method_details ">
|
1042
|
-
<h3 class="signature " id="preferred_locales-instance_method">
|
1043
|
-
|
1044
|
-
#<strong>preferred_locales</strong>(env) ⇒ <tt>Object</tt>
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
</h3><table class="source_code">
|
1051
|
-
<tr>
|
1052
|
-
<td>
|
1053
|
-
<pre class="lines">
|
1054
|
-
|
1055
|
-
|
1056
|
-
105
|
1057
|
-
106
|
1058
|
-
107
|
1059
|
-
108
|
1060
|
-
109
|
1061
|
-
110
|
1062
|
-
111
|
1063
|
-
112
|
1064
|
-
113
|
1065
|
-
114
|
1066
|
-
115
|
1067
|
-
116
|
1068
|
-
117
|
1069
|
-
118
|
1070
|
-
119
|
1071
|
-
120
|
1072
|
-
121
|
1073
|
-
122
|
1074
|
-
123
|
1075
|
-
124
|
1076
|
-
125
|
1077
|
-
126
|
1078
|
-
127
|
1079
|
-
128
|
1080
|
-
129</pre>
|
1081
|
-
</td>
|
1082
|
-
<td>
|
1083
|
-
<pre class="code"><span class="info file"># File 'lib/utopia/localization.rb', line 105</span>
|
1084
|
-
|
1085
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_preferred_locales'>preferred_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
1086
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_to_enum'>to_enum</span><span class='lparen'>(</span><span class='symbol'>:preferred_locales</span><span class='comma'>,</span> <span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
1087
|
-
|
1088
|
-
<span class='comment'># Keep track of what locales have been tried:
|
1089
|
-
</span> <span class='id identifier rubyid_locales'>locales</span> <span class='op'>=</span> <span class='const'>Set</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1090
|
-
|
1091
|
-
<span class='id identifier rubyid_host_preferred_locales'>host_preferred_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_locale'>locale</span><span class='op'>|</span>
|
1092
|
-
<span class='kw'>yield</span> <span class='id identifier rubyid_env'>env</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#CURRENT_LOCALE_KEY-constant" title="Utopia::Localization::CURRENT_LOCALE_KEY (constant)">CURRENT_LOCALE_KEY</a></span></span> <span class='op'>=></span> <span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_locales'>locales</span><span class='period'>.</span><span class='id identifier rubyid_add?'>add?</span> <span class='id identifier rubyid_locale'>locale</span>
|
1093
|
-
<span class='kw'>end</span>
|
1094
|
-
|
1095
|
-
<span class='id identifier rubyid_request_preferred_locale'>request_preferred_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_locale'>locale</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='op'>|</span>
|
1096
|
-
<span class='comment'># We have extracted a locale from the path, so from this point on we should use the updated path:
|
1097
|
-
</span> <span class='id identifier rubyid_env'>env</span> <span class='op'>=</span> <span class='id identifier rubyid_env'>env</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='const'>Rack</span><span class='op'>::</span><span class='const'>PATH_INFO</span> <span class='op'>=></span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span>
|
1098
|
-
|
1099
|
-
<span class='kw'>yield</span> <span class='id identifier rubyid_env'>env</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#CURRENT_LOCALE_KEY-constant" title="Utopia::Localization::CURRENT_LOCALE_KEY (constant)">CURRENT_LOCALE_KEY</a></span></span> <span class='op'>=></span> <span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_locales'>locales</span><span class='period'>.</span><span class='id identifier rubyid_add?'>add?</span> <span class='id identifier rubyid_locale'>locale</span>
|
1100
|
-
<span class='kw'>end</span>
|
1101
|
-
|
1102
|
-
<span class='id identifier rubyid_browser_preferred_locales'>browser_preferred_locales</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_locale'>locale</span><span class='op'>|</span>
|
1103
|
-
<span class='kw'>yield</span> <span class='id identifier rubyid_env'>env</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#CURRENT_LOCALE_KEY-constant" title="Utopia::Localization::CURRENT_LOCALE_KEY (constant)">CURRENT_LOCALE_KEY</a></span></span> <span class='op'>=></span> <span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_locales'>locales</span><span class='period'>.</span><span class='id identifier rubyid_add?'>add?</span> <span class='id identifier rubyid_locale'>locale</span>
|
1104
|
-
<span class='kw'>end</span>
|
1105
|
-
|
1106
|
-
<span class='ivar'>@default_locales</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_locale'>locale</span><span class='op'>|</span>
|
1107
|
-
<span class='kw'>yield</span> <span class='id identifier rubyid_env'>env</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#CURRENT_LOCALE_KEY-constant" title="Utopia::Localization::CURRENT_LOCALE_KEY (constant)">CURRENT_LOCALE_KEY</a></span></span> <span class='op'>=></span> <span class='id identifier rubyid_locale'>locale</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_locales'>locales</span><span class='period'>.</span><span class='id identifier rubyid_add?'>add?</span> <span class='id identifier rubyid_locale'>locale</span>
|
1108
|
-
<span class='kw'>end</span>
|
1109
|
-
<span class='kw'>end</span></pre>
|
1110
|
-
</td>
|
1111
|
-
</tr>
|
1112
|
-
</table>
|
1113
|
-
</div>
|
1114
|
-
|
1115
|
-
<div class="method_details ">
|
1116
|
-
<h3 class="signature " id="request_preferred_locale-instance_method">
|
1117
|
-
|
1118
|
-
#<strong>request_preferred_locale</strong>(env) ⇒ <tt>Object</tt>
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
</h3><table class="source_code">
|
1125
|
-
<tr>
|
1126
|
-
<td>
|
1127
|
-
<pre class="lines">
|
1128
|
-
|
1129
|
-
|
1130
|
-
140
|
1131
|
-
141
|
1132
|
-
142
|
1133
|
-
143
|
1134
|
-
144
|
1135
|
-
145
|
1136
|
-
146
|
1137
|
-
147
|
1138
|
-
148
|
1139
|
-
149</pre>
|
1140
|
-
</td>
|
1141
|
-
<td>
|
1142
|
-
<pre class="code"><span class="info file"># File 'lib/utopia/localization.rb', line 140</span>
|
1143
|
-
|
1144
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_request_preferred_locale'>request_preferred_locale</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
1145
|
-
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Path.html" title="Utopia::Path (class)">Path</a></span></span><span class='lbracket'>[</span><span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='const'>Rack</span><span class='op'>::</span><span class='const'>PATH_INFO</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
1146
|
-
|
1147
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_request_locale'>request_locale</span> <span class='op'>=</span> <span class='ivar'>@all_locales</span><span class='period'>.</span><span class='id identifier rubyid_patterns'>patterns</span><span class='lbracket'>[</span><span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='rbracket'>]</span>
|
1148
|
-
<span class='comment'># Remove the localization prefix:
|
1149
|
-
</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_delete_at'>delete_at</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
|
1150
|
-
|
1151
|
-
<span class='kw'>yield</span> <span class='id identifier rubyid_request_locale'>request_locale</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span>
|
1152
|
-
<span class='kw'>end</span>
|
1153
|
-
<span class='kw'>end</span></pre>
|
1154
|
-
</td>
|
1155
|
-
</tr>
|
1156
|
-
</table>
|
1157
|
-
</div>
|
1158
|
-
|
1159
|
-
<div class="method_details ">
|
1160
|
-
<h3 class="signature " id="vary-instance_method">
|
1161
|
-
|
1162
|
-
#<strong>vary</strong>(env, response) ⇒ <tt>Object</tt>
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
</h3><div class="docstring">
|
1169
|
-
<div class="discussion">
|
1170
|
-
<p>Set the Vary: header on the response to indicate that this response should include the header in the cache key.</p>
|
1171
|
-
|
1172
|
-
|
1173
|
-
</div>
|
1174
|
-
</div>
|
1175
|
-
<div class="tags">
|
1176
|
-
|
1177
|
-
|
1178
|
-
</div><table class="source_code">
|
1179
|
-
<tr>
|
1180
|
-
<td>
|
1181
|
-
<pre class="lines">
|
1182
|
-
|
1183
|
-
|
1184
|
-
182
|
1185
|
-
183
|
1186
|
-
184
|
1187
|
-
185
|
1188
|
-
186
|
1189
|
-
187
|
1190
|
-
188
|
1191
|
-
189
|
1192
|
-
190
|
1193
|
-
191
|
1194
|
-
192
|
1195
|
-
193
|
1196
|
-
194
|
1197
|
-
195
|
1198
|
-
196
|
1199
|
-
197
|
1200
|
-
198
|
1201
|
-
199</pre>
|
1202
|
-
</td>
|
1203
|
-
<td>
|
1204
|
-
<pre class="code"><span class="info file"># File 'lib/utopia/localization.rb', line 182</span>
|
1205
|
-
|
1206
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_vary'>vary</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='comma'>,</span> <span class='id identifier rubyid_response'>response</span><span class='rparen'>)</span>
|
1207
|
-
<span class='id identifier rubyid_headers'>headers</span> <span class='op'>=</span> <span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
1208
|
-
|
1209
|
-
<span class='comment'># This response was based on the Accept-Language header:
|
1210
|
-
</span> <span class='kw'>if</span> <span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Vary</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1211
|
-
<span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Vary</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>+=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>,Accept-Language</span><span class='tstring_end'>'</span></span>
|
1212
|
-
<span class='kw'>else</span>
|
1213
|
-
<span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Vary</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Accept-Language</span><span class='tstring_end'>'</span></span>
|
1214
|
-
<span class='kw'>end</span>
|
1215
|
-
|
1216
|
-
<span class='comment'># Althought this header is generally not supported, we supply it anyway as it is useful for debugging:
|
1217
|
-
</span> <span class='kw'>if</span> <span class='id identifier rubyid_locale'>locale</span> <span class='op'>=</span> <span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="#CURRENT_LOCALE_KEY-constant" title="Utopia::Localization::CURRENT_LOCALE_KEY (constant)">CURRENT_LOCALE_KEY</a></span></span><span class='rbracket'>]</span>
|
1218
|
-
<span class='comment'># Set the Content-Location to point to the localized URI as requested:
|
1219
|
-
</span> <span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Content-Location</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_locale'>locale</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='op'>+</span> <span class='id identifier rubyid_env'>env</span><span class='lbracket'>[</span><span class='const'>Rack</span><span class='op'>::</span><span class='const'>PATH_INFO</span><span class='rbracket'>]</span>
|
1220
|
-
<span class='kw'>end</span>
|
1221
|
-
|
1222
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_response'>response</span>
|
1223
|
-
<span class='kw'>end</span></pre>
|
1224
|
-
</td>
|
1225
|
-
</tr>
|
1226
|
-
</table>
|
1227
|
-
</div>
|
1228
|
-
|
1229
|
-
</div>
|
1230
|
-
|
1231
|
-
</div>
|
1232
|
-
|
1233
|
-
<div id="footer">
|
1234
|
-
Generated on Sat Mar 9 12:01:53 2019 by
|
1235
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1236
|
-
0.9.18 (ruby-2.6.1).
|
1237
|
-
</div>
|
1238
|
-
|
1239
|
-
</div>
|
1240
|
-
</body>
|
1241
|
-
</html>
|