Skip to content

Conversation

@Bayselonarrend
Copy link
Contributor

@Bayselonarrend Bayselonarrend commented Apr 23, 2025

Поправил/дописал английские варианты в ContextMethod-ы, ContextClass-ы, EnumerationType-ы и пр. где ловил ошибки или видел пропущенные переводы. Надеюсь, я правильно понял, как это работает)

Summary by CodeRabbit

  • New Features

    • Added English aliases for all public methods and enum values previously available only in Russian, improving accessibility for English-speaking users.
    • Updated method and enum annotations to support both Russian and English identifiers across binary data operations, console functions, and template types.
    • Deprecated the "ProgramDirectory" alias in favor of "BinDir" for program directory access.
  • Style

    • Enhanced bilingual support throughout the user interface for method and enum names.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 23, 2025

Walkthrough

This change introduces English aliases to various context methods and enum values across several classes, supplementing the existing Russian identifiers. The modifications are limited to attributes and annotations, providing bilingual support for method and enum access without altering any underlying logic or control flow.

Changes

File(s) Change Summary
src/OneScript.StandardLibrary/Binary/GlobalBinaryData.cs Added English aliases to all [ContextMethod] attributes, enabling bilingual method access.
src/OneScript.StandardLibrary/Binary/MemoryStreamContext.cs Added English alias "CloseAndGetBinaryData" to an existing context method attribute.
src/OneScript.StandardLibrary/Binary/StreamEnums.cs Added English aliases to all EnumValue attributes in FileOpenModeEnum, FileAccessEnum, and StreamPositionEnum.
src/OneScript.StandardLibrary/StringOperations.cs Updated SearchDirection enum values to include English aliases in their EnumValue attributes.
src/OneScript.StandardLibrary/Text/ConsoleContext.cs Added English alias "Beep" to the [ContextMethod] attribute of the Beep method.
src/ScriptEngine.HostedScript/SystemGlobalContext.cs Changed [ContextMethod] attributes for ProgramDirectory(), marking English alias as deprecated and renaming the second alias to "BinDir".
src/ScriptEngine.HostedScript/TemplateStorage.cs Added English aliases to EnumValue attributes for TemplateKind enum values.

Possibly related PRs

  • EvilBeaver/OneScript#1466: Modifies the ContextMethodAttribute constructor and logic to better handle and retrieve method aliases, directly relating to the addition of English aliases in this PR.

Poem

In a meadow of code where languages meet,
Russian and English now share every seat.
Methods and enums, once shy and alone,
Now speak in two tongues, their meanings well known.
Bilingual bunnies, we hop and we cheer—
For code that says "hello" and "привет" loud and clear!
🐇✨


📜 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 fd4b3cd and e134a35.

📒 Files selected for processing (1)
  • src/OneScript.StandardLibrary/Binary/StreamEnums.cs (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/OneScript.StandardLibrary/Binary/StreamEnums.cs
✨ Finishing Touches
  • 📝 Generate Docstrings

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 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.

@EvilBeaver
Copy link
Owner

Если я не ошибаюсь, когда синоним не указан, он берется из имени метода. Т.е. если имя C# метода совпадает с английским названием в языке - то синоним указывать не обязательно.

Это, конечно, может не работать, но в этих классах синонимы пропущены намеренно.

@Bayselonarrend
Copy link
Contributor Author

Если я не ошибаюсь, когда синоним не указан, он берется из имени метода. Т.е. если имя C# метода совпадает с английским названием в языке - то синоним указывать не обязательно.

Это, конечно, может не работать, но в этих классах синонимы пропущены намеренно.

Тогда вопрос только в 'КаталогПрограммы' и 'ПозицияВПотоке'

}

[EnumerationType("ПозицияВПотоке", "StreamPosition")]
[ContextMethod("StreamPosition", IsDeprecated = true)]
Copy link
Owner

Choose a reason for hiding this comment

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

Зачем атрибут ContextMethod на енуме?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ага, проглядел. А у EnumerationType есть возможность установить IsDeprecated = true?

Copy link
Owner

Choose a reason for hiding this comment

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

По-моему нет. Но, очевидно, он нужен и на енуме и на классе

Copy link
Contributor Author

@Bayselonarrend Bayselonarrend Apr 30, 2025

Choose a reason for hiding this comment

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

Просто добавить public bool IsDeprecated { get; set; } недостаточно будет, да?

Нет, ведь нужна будет еще ответная часть, которая будет обрабатывать это свойство.

@EvilBeaver
Copy link
Owner

@Bayselonarrend там не собирается билд, исправь, пожалуйста:

 D:\jenkins\workspace\1Script_PR\src\OneScript.StandardLibrary\Binary\StreamEnums.cs(40,40): error CS0246: Не удалось найти тип или имя пространства имен "IsDeprecated" (возможно, отсутствует директива using или ссылка на сборку). [D:\jenkins\workspace\1Script_PR\src\OneScript.StandardLibrary\OneScript.StandardLibrary.csproj]

https://build.oscript.io/job/1Script/view/change-requests/job/PR-1533/6/

@Bayselonarrend
Copy link
Contributor Author

@EvilBeaver он не собирается, потому что я поставил EnumerationType с IsDepricated, а такого атрибута там нет. Не допилил по последнему комменту, что мы обсуждали

@Bayselonarrend
Copy link
Contributor Author

Ну, оно не падает, но, как я понял, ничего и не делает. У меня знания шарпа мягко говоря ограниченные, не знаю что дальше. Наверное тут надо что-то добавить

{4B3E41DC-58A6-4706-A230-8D1ACFAB4655}

И вероятно в Machine.Contexts.EnumerationContext. Но без подсказки могу только фигни какой-нибудь наделать

@Bayselonarrend
Copy link
Contributor Author

Ну, оно не падает

Или падает. Что-то я ничего не понял

@Bayselonarrend
Copy link
Contributor Author

@EvilBeaver вроде так

@EvilBeaver EvilBeaver merged commit bd084c3 into EvilBeaver:develop May 28, 2025
2 checks passed
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