-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathlocale.json
More file actions
21 lines (21 loc) · 2.08 KB
/
Copy pathlocale.json
File metadata and controls
21 lines (21 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://www.rubyschema.org/i18n/locale.json",
"title": "I18n Locale",
"markdownDescription": "**Rails I18n (Internationalization) locale files** store translations for your Ruby on Rails application. These YAML or JSON files provide language-specific strings, date/time formats, number formats, and Active Record model/attribute translations.\n\n**File location:** `config/locales/*.yml` (or `.json`)\n\n**Structure:** Nested hash with locale code as root key (e.g., `en:`, `es:`, `ja:`)\n\n**Common top-level keys:**\n- **`activerecord`** - Model names, attributes, and validation error messages\n- **`activemodel`** - Non-ActiveRecord model translations\n- **`date`** / **`time`** / **`datetime`** - Date/time format strings\n- **`number`** / **`currency`** - Number and currency formatting\n- **`support`** - Common words like \"array\" connector phrases\n- **`errors.messages`** - Generic error messages\n- **Custom keys** - Your application-specific translations\n\n**Usage in code:**\n```ruby\nI18n.t('welcome.title') # => \"Welcome!\"\nI18n.l(Time.now, format: :short) # => \"11 Feb 15:30\"\n```\n\n**Usage in views:**\n```erb\n<%= t('.title') %> <!-- Lazy lookup: scoped to view path -->\n<%= l @post.created_at, format: :long %>\n```\n\n**Variable interpolation:**\n```yaml\ngreeting: \"Hello, %{name}!\"\n```\n```ruby\nI18n.t('greeting', name: 'Alice') # => \"Hello, Alice!\"\n```\n\n**Pluralization:**\n```yaml\ninbox:\n zero: \"no messages\"\n one: \"one message\"\n other: \"%{count} messages\"\n```\n\n[Rails I18n Guide](https://guides.rubyonrails.org/i18n.html) | [I18n Gem](https://github.com/ruby-i18n/i18n) | [rails-i18n Community Translations](https://github.com/svenfuchs/rails-i18n)",
"type": "object",
"definitions": {
"config": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"oneOf": [{ "type": "string" }, { "$ref": "#/definitions/config" }]
}
}
},
"additionalProperties": {
"$ref": "#/definitions/config"
}
}