Skip to content

Comments

feat: add detect_language and get_languages functions#1

Merged
pabvald merged 2 commits intomainfrom
feature/detect-languages
Feb 19, 2026
Merged

feat: add detect_language and get_languages functions#1
pabvald merged 2 commits intomainfrom
feature/detect-languages

Conversation

@pabvald
Copy link
Member

@pabvald pabvald commented Feb 19, 2026

New features

  • feat: detect_language for single and multiple texts using the translate endpoint
  • feat: get_languages to list supported source/target languages via GET request
  • feat: get_request HTTP helper and AUTH_HEADERS constant

Changes

  • refactor: error handling

Documentation

  • docs: update README with documentation and usage examples
  • docs: add CLAUDE.md with project conventions

- Add `detect_language` for single and multiple texts using the translate endpoint
- Add `get_languages` to list supported source/target languages via GET request
- Add `get_request` HTTP helper and `AUTH_HEADERS` constant
- Update README with documentation and usage examples
- Add CLAUDE.md with project conventions
- Add tests for new functions
- Bump version to 0.3.0
@pabvald pabvald requested a review from Copilot February 19, 2026 08:41
@pabvald pabvald added the enhancement New feature or request label Feb 19, 2026
@pabvald pabvald self-assigned this Feb 19, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds new public API surface to the DeepL.jl SDK for language detection and language listing, plus supporting HTTP helper(s) and documentation updates.

Changes:

  • Add detect_language (single and vector overloads) implemented via the /translate endpoint.
  • Add get_languages implemented via a new get_request helper for /languages.
  • Update exports, tests, README, changelog, and add CLAUDE.md conventions doc.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/detect.jl New detect_language API (String + Vector dispatch) using /translate.
src/languages.jl New get_languages API using /languages via GET.
src/client.jl Add AUTH_HEADERS and get_request helper for GET calls.
src/DeepL.jl Include new source files and export new public APIs.
test/runtests.jl Add integration tests for detect_language and get_languages.
README.md Document new functions and provide usage examples.
CHANGELOG.md Document the 0.3.0 release additions.
CLAUDE.md Add repository conventions / contributor reference.
Project.toml Bump version to 0.3.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

src/languages.jl Outdated
response = get_request("/languages"; params=Dict("type" => type))
error_message = handle_api_error(response)
if !isempty(error_message)
return error_message
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

get_languages returns error_message (a String) when the API request fails, but on success it returns a parsed JSON array (a Vector). This makes the function’s return type inconsistent with its docstring (Vector{Dict{String,Any}}) and will break callers that expect an iterable list. Consider keeping the return type consistent by throwing an exception on API errors (or returning an empty Vector plus logging) instead of returning a String.

Suggested change
return error_message
throw(ErrorException(error_message))

Copilot uses AI. Check for mistakes.
@pabvald pabvald merged commit 85d7614 into main Feb 19, 2026
1 check passed
@pabvald pabvald deleted the feature/detect-languages branch February 19, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant