Skip to content

feat: Add Azerbaijani language to i18n package#164

Merged
Oudwins merged 2 commits intoOudwins:masterfrom
aykhans:feat/i18n-az-package
Jul 2, 2025
Merged

feat: Add Azerbaijani language to i18n package#164
Oudwins merged 2 commits intoOudwins:masterfrom
aykhans:feat/i18n-az-package

Conversation

@aykhans
Copy link
Contributor

@aykhans aykhans commented Jun 13, 2025

This pull request adds Azerbaijani (az) language support for validation messages.

Let me know if any adjustments are needed.

Thanks for your great work on this library!

Summary by CodeRabbit

  • New Features
    • Added Azerbaijani language support for validation error messages, providing localized feedback for various validation scenarios.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 13, 2025

Walkthrough

A new Go file has been introduced to provide Azerbaijani translations for validation error messages. It defines a variable containing a nested map structure, mapping validation types and issue codes to Azerbaijani message templates with dynamic placeholders, supporting both positive and negative validation scenarios.

Changes

File(s) Change Summary
i18n/az/az.go Added Azerbaijani translation map for validation error messages, including templates for all types.

Poem

In fields of code where errors grow,
Azerbaijani words now softly flow.
Validation whispers, clear and bright,
Guiding users, day and night.
With every check, a local touch,
The rabbit smiles—thank you so much!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a800932 and 256817d.

📒 Files selected for processing (1)
  • i18n/az/az.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • i18n/az/az.go
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch feat/i18n-az-package
  • Post Copyable Unit Tests in Comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6c468c and a800932.

📒 Files selected for processing (1)
  • i18n/az/az.go (1 hunks)
🔇 Additional comments (7)
i18n/az/az.go (7)

1-2: Package declaration is correct
The az package name aligns with the Azerbaijani locale code.


3-5: Imports look good
The zconst import path is correct and used consistently in the map.


7-7: Ensure language registration
Make sure you’ve added az.Map to the global language registry in the main i18n package so that these translations are picked up at runtime.


8-40: String translations are comprehensive
All common string validation issue codes and their negations are covered with appropriate placeholders.


41-48: Boolean translations are correct
The boolean issue codes (Required, NotNil, True, False, EQ) are translated as expected.


62-69: Time translations are accurate
The time-related codes (After, Before, EQ) and their messages are properly localized.


81-90: Struct translations are in place
The struct validation messages, including JSON and ZHTTP issues, are fully covered.

Comment on lines +49 to +61
zconst.TypeNumber: {
zconst.IssueCodeRequired: "tələb olunur",
zconst.IssueCodeNotNil: "boş olmamalıdır",
zconst.IssueCodeLTE: "rəqəm {{lte}}-dən kiçik və ya bərabər olmalıdır",
zconst.IssueCodeLT: "rəqəm {{lt}}-dən kiçik olmalıdır",
zconst.IssueCodeGTE: "rəqəm {{gte}}-dən böyük və ya bərabər olmalıdır",
zconst.IssueCodeGT: "rəqəm {{gt}}-dən böyük olmalıdır",
zconst.IssueCodeEQ: "rəqəm {{eq}}-ə bərabər olmalıdır",
zconst.NotIssueCode(zconst.IssueCodeEQ): "rəqəm {{eq}}-ə bərabər olmamalıdır",
zconst.IssueCodeOneOf: "rəqəm {{options}} variantlarından biri olmalıdır",
zconst.NotIssueCode(zconst.IssueCodeOneOf): "rəqəm {{options}} variantlarından biri olmamalıdır",
zconst.IssueCodeFallback: "rəqəm yanlışdır",
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Unify placeholder names for one-of options
In the number block, you use the {{options}} placeholder, but in the string block it’s {{one_of_options}}. Use a consistent placeholder key across types to avoid mismatches during substitution.

Proposed diff:

-       zconst.IssueCodeOneOf:                      "rəqəm {{options}} variantlarından biri olmalıdır",
-       zconst.NotIssueCode(zconst.IssueCodeOneOf): "rəqəm {{options}} variantlarından biri olmamalıdır",
+       zconst.IssueCodeOneOf:                      "rəqəm {{one_of_options}} variantlarından biri olmalıdır",
+       zconst.NotIssueCode(zconst.IssueCodeOneOf): "rəqəm {{one_of_options}} variantlarından biri olmamalıdır",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
zconst.TypeNumber: {
zconst.IssueCodeRequired: "tələb olunur",
zconst.IssueCodeNotNil: "boş olmamalıdır",
zconst.IssueCodeLTE: "rəqəm {{lte}}-dən kiçik və ya bərabər olmalıdır",
zconst.IssueCodeLT: "rəqəm {{lt}}-dən kiçik olmalıdır",
zconst.IssueCodeGTE: "rəqəm {{gte}}-dən böyük və ya bərabər olmalıdır",
zconst.IssueCodeGT: "rəqəm {{gt}}-dən böyük olmalıdır",
zconst.IssueCodeEQ: "rəqəm {{eq}}-ə bərabər olmalıdır",
zconst.NotIssueCode(zconst.IssueCodeEQ): "rəqəm {{eq}}-ə bərabər olmamalıdır",
zconst.IssueCodeOneOf: "rəqəm {{options}} variantlarından biri olmalıdır",
zconst.NotIssueCode(zconst.IssueCodeOneOf): "rəqəm {{options}} variantlarından biri olmamalıdır",
zconst.IssueCodeFallback: "rəqəm yanlışdır",
},
zconst.TypeNumber: {
zconst.IssueCodeRequired: "tələb olunur",
zconst.IssueCodeNotNil: "boş olmamalıdır",
zconst.IssueCodeLTE: "rəqəm {{lte}}-dən kiçik və ya bərabər olmalıdır",
zconst.IssueCodeLT: "rəqəm {{lt}}-dən kiçik olmalıdır",
zconst.IssueCodeGTE: "rəqəm {{gte}}-dən böyük və ya bərabər olmalıdır",
zconst.IssueCodeGT: "rəqəm {{gt}}-dən böyük olmalıdır",
zconst.IssueCodeEQ: "rəqəm {{eq}}-ə bərabər olmalıdır",
zconst.NotIssueCode(zconst.IssueCodeEQ): "rəqəm {{eq}}-ə bərabər olmamalıdır",
zconst.IssueCodeOneOf: "rəqəm {{one_of_options}} variantlarından biri olmalıdır",
zconst.NotIssueCode(zconst.IssueCodeOneOf): "rəqəm {{one_of_options}} variantlarından biri olmamalıdır",
zconst.IssueCodeFallback: "rəqəm yanlışdır",
},
🤖 Prompt for AI Agents
In i18n/az/az.go between lines 49 and 61, the placeholder for the one-of options
is inconsistent; it uses {{options}} here but {{one_of_options}} elsewhere. To
fix this, unify the placeholder name by replacing all instances of {{options}}
with {{one_of_options}} in this number block to ensure consistent substitution
across types.

@Oudwins
Copy link
Owner

Oudwins commented Jun 14, 2025

Hey! I really appreciate you taking the time to translate the errors and make the PR. And thank you for your kind words!

I'm a bit hesitant to add first party error maps for other languages as I will not be able to keep the maps up to date. I can do so for english and spanish as I speak both of those languages.

But it would be awesome for the community to be able to have access to this ready made translations. I'm undecided on the best approach to take though, some of the ideas that have come to mind are:

  1. Create different repos for the languages which can keep themselves up to date by being down stream from the main Zog project. But this means you might have to install multiple packages to get all the languages you need which is probably not ideal.
  2. Have someone take up the mantle of keeping the translations up to date for any new language. But this will still have the issue of having to wait until that person can handle the translations before we do any release that contains new or changed errors
  3. Create some auto translation system that updates translations as we go (probably by querying GPT) and then we can get PRs to fix the incorrect translations as we go.
  4. ??

What do you think? Any ideas?

@aykhans
Copy link
Contributor Author

aykhans commented Jun 14, 2025

I understand your hesitation.

Using GPT to generate translations and then accepting PRs to correct any mistakes seems like the most practical approach for now. (I’d be happy to help maintain the Azerbaijani translations and address any issues that come up.)

Since users can temporarily override incorrect translations until patches are available, this seems like a reasonable solution at this stage.

@Oudwins
Copy link
Owner

Oudwins commented Jul 2, 2025

Hey! Sorry to have taken so long to reply. I have been very busy with work and was also pondering this. I think I agree with you. And I very much appreciate your kindness in offering to maintain it.

For now lets merge this as a third party maintained language (or something like that). I'll add it to the docs. In the future I would like to build something to auto handles the translations, we have something like that at work.

@Oudwins Oudwins merged commit 6b75bad into Oudwins:master Jul 2, 2025
5 checks passed
Oudwins pushed a commit that referenced this pull request Oct 3, 2025
* feat: add az package to i18n

* fix typos
Oudwins pushed a commit that referenced this pull request Dec 14, 2025
* feat: add az package to i18n

* fix typos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants