Class: RailsAiContext::Tools::GetI18n
- Defined in:
- lib/rails_ai_context/tools/get_i18n.rb
Constant Summary
Constants inherited from BaseTool
BaseTool::DEFAULT_SESSION, BaseTool::MAX_SESSIONS, BaseTool::MAX_SESSION_ID_LENGTH, BaseTool::SESSION_CONTEXT, BaseTool::SHARED_CACHE
Class Method Summary collapse
Methods inherited from BaseTool
abstract!, abstract?, api_only_app?, api_only_note, cache_key, cached_context, config, current_session, #dedupe_put_patch_routes, detail_param?, error_response, evict_oldest_sessions, extract_method_source_from_file, extract_method_source_from_string, find_closest_match, fuzzy_find_key, guide_row, inherited, introspection_warnings_note, invalid_detail_note, normalize_detail, not_found_response, paginate, rails_app, rails_env_name, registered_tools, reset_all_caches!, reset_cache!, session_from, session_params, session_queries, session_record, session_reset!, static_tier_banner, static_tier_refusal, text_response, touch_session, unavailable_note, with_session, with_session_for
Methods included from SectionFetch
Class Method Details
.call(locale: nil, offset: 0, limit: nil, server_context: nil) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rails_ai_context/tools/get_i18n.rb', line 37 def self.call(locale: nil, offset: 0, limit: nil, server_context: nil) fetch_section(:i18n, subject: "I18n introspection") do |i18n| available = i18n[:available_locales] || [] if locale match = find_closest_match(locale, available) return not_found_response("Locale", locale, available, recovery_tool: "omit `locale` for the full I18n picture") unless match return render_locale(i18n, match, offset: offset, limit: limit) end render_overview(i18n, offset: offset, limit: limit) end end |