• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

go-playground / validator / 13687129122 / 1
74%
v8: 100%

Build:
Build:
LAST BUILD BRANCH: #1519/feature/trx_addr-tag
DEFAULT BRANCH: v8
Ran 05 Mar 2025 10:51PM UTC
Files 33
Run time 1s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

05 Mar 2025 10:51PM UTC coverage: 74.466% (-0.4%) from 74.823%
13687129122.1

push

github

web-flow
Fix: Nil pointer dereference in Arabic translations (#1391)

## Fixes or Enhances
**Make sure that you've checked the boxes below before you submit PR:**
- [x] Tests exist or have been written that cover this particular
change.

### Description
This PR fixes [Bug #1385]: Nil pointer dereference in Arabic
translations and adds comprehensive Arabic (ar) translations for the
go-playground/validator package. The implementation provides Arabic
error messages for all common validation tags, making the validator more
valuable to Arabic-speaking developers.

### Features
- Fixes nil pointer dereference bug in Arabic translations
- Complete Arabic translations for all standard validation tags
- Comprehensive test suite to verify translation accuracy
- Follows the same pattern as existing language translations
- Properly handles Arabic text direction and grammar

### Implementation Details
- The implementation follows the established pattern in the validator
package:
- Registers translations for each validation tag
- Provides appropriate Arabic phrasing for validation errors
- Handles parameter substitution in error messages
- Includes tests for all validation scenarios

### Testing
- A comprehensive test suite is included that verifies:
- Basic validations (required, email, etc.)
- Length validations (min, max, len)
- Comparison validations (lt, lte, gt, gte, eq, ne)
- Field comparison validations (eqfield, nefield, gtefield)
- Content validations (alpha, alphanum, contains, etc.)
- Special validations (oneof, datetime)
- All tests pass and confirm that the translations are correctly
applied.

### Usage Example
```go
validate := validator.New()
arabic := ar.New()
uni := ut.New(arabic, arabic)
trans, _ := uni.GetTranslator("ar")

// Register Arabic translations
ar.RegisterDefaultTranslations(validate, trans)

// Now validation errors will be in Arabic
err := validate.Struct(myStruct)
if err != nil {
    errs := err.(validator.ValidationErrors)
    for _, e := r... (continued)

14331 of 19245 relevant lines covered (74.47%)

76.29 hits per line

Source Files on job 13687129122.1
  • Tree
  • List 33
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 13687129122
  • bae7f6d3 on github
  • Prev Job for on master (#13687059555.1)
  • Next Job for on master (#13778465291.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc