<fieldset>
<div class="standard-form-row">
<label class="standard-label"><%= t ".external auth" %></label>
- <%= f.select :auth_provider, Auth::PROVIDERS %>
+ <%= f.select :auth_provider, Auth.providers %>
<%= f.text_field :auth_uid %>
<span class="form-help deemphasize">(<a href="<%= t ".openid.link" %>" target="_new"><%= t ".openid.link text" %></a>)</span>
</div>
<label for="openid_url" class="standard-label">
<%= t ".external auth" %>
</label>
- <%= f.select(:auth_provider, Auth::PROVIDERS, :default => "", :tabindex => 4) %>
+ <%= f.select(:auth_provider, Auth.providers, :default => "", :tabindex => 4) %>
<%= f.text_field(:auth_uid, :tabindex => 5) %>
<%= f.error_message_on(:auth_uid) %>
</div>
module Auth
- PROVIDERS = {
- I18n.t("auth.providers.none") => "",
- I18n.t("auth.providers.openid") => "openid"
- }.tap do |providers|
- providers[I18n.t("auth.providers.google")] = "google" if Settings.key?(:google_auth_id)
- providers[I18n.t("auth.providers.facebook")] = "facebook" if Settings.key?(:facebook_auth_id)
- providers[I18n.t("auth.providers.windowslive")] = "windowslive" if Settings.key?(:windowslive_auth_id)
- providers[I18n.t("auth.providers.github")] = "github" if Settings.key?(:github_auth_id)
- providers[I18n.t("auth.providers.wikipedia")] = "wikipedia" if Settings.key?(:wikipedia_auth_id)
- end.freeze
+ @providers = {}
+
+ def self.providers
+ @providers[I18n.locale] ||= {
+ I18n.t("auth.providers.none") => "",
+ I18n.t("auth.providers.openid") => "openid"
+ }.tap do |providers|
+ providers[I18n.t("auth.providers.google")] = "google" if Settings.key?(:google_auth_id)
+ providers[I18n.t("auth.providers.facebook")] = "facebook" if Settings.key?(:facebook_auth_id)
+ providers[I18n.t("auth.providers.windowslive")] = "windowslive" if Settings.key?(:windowslive_auth_id)
+ providers[I18n.t("auth.providers.github")] = "github" if Settings.key?(:github_auth_id)
+ providers[I18n.t("auth.providers.wikipedia")] = "wikipedia" if Settings.key?(:wikipedia_auth_id)
+ end.freeze
+ end
end