Skip to content

Implement translation data retrieval endpoint and validation logic#61

Open
axif0 wants to merge 3 commits into
scribe-org:mainfrom
axif0:translation
Open

Implement translation data retrieval endpoint and validation logic#61
axif0 wants to merge 3 commits into
scribe-org:mainfrom
axif0:translation

Conversation

@axif0
Copy link
Copy Markdown
Member

@axif0 axif0 commented May 5, 2026

Contributor checklist

  • This pull request is on a separate branch and not the main branch
  • I have ran the ./pre-commit executable as well as make lint and have fixed all reported issues

Description

  • Added a new endpoint to retrieve translation data between source and target languages.
  • Implemented validation for language codes used in translation requests.
  • Introduced models for translation data response and updated error handling for invalid requests.
  • Enhanced table name validation for translation data in the database.
image

In local MariaDB:

image

Related issue

@axif0 axif0 requested review from DeleMike and andrewtavis May 5, 2026 20:53
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Thank you for the pull request! 💙🩵

The Scribe-Server team will do our best to address your contribution as soon as we can. The following are some important points:

  • Those interested in developing their skills and expanding their role in the community should read the mentorship and growth section of the contribution guide
  • If you're not already a member of our public Matrix community, please consider joining!
    • We'd suggest that you use the Element client as well as Element X for a mobile app
    • Join the General and Data rooms once you're in
  • Also consider attending our bi-weekly Saturday developer syncs!
    • Details are shared in the General room on Matrix each Wednesday before the sync
    • It would be great to meet you 😊

Note

Scribe uses Conventional Comments in reviews to make sure that communication is as clear as possible.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Maintainer Checklist

The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

  • Tests for changes have been written and the continuous integration (CI) workflows within the PR checks do not indicate new errors in the files changed

  • The CHANGELOG has been updated with a description of the changes for the upcoming release and the corresponding issue (if necessary)

@andrewtavis
Copy link
Copy Markdown
Member

Absolutely amazing to have this PR open, @axif0!

@andrewtavis
Copy link
Copy Markdown
Member

Was there anything else in Scribe-Data that needed to be fixed? Feel free to open more PRs if there is anything. If not, then I can go through sometime tomorrow and do an update of the chnagelog and release v6.0.0. From there we can do minor releases for the rest of the open Scribe-Data issues :)

@axif0
Copy link
Copy Markdown
Member Author

axif0 commented May 5, 2026

Was there anything else in Scribe-Data that needed to be fixed?

I'm seeing any major issue's on Scribe-Data. But I think scribe-data.readthedocs.io needs to update for translations commands 😅 .

@andrewtavis
Copy link
Copy Markdown
Member

Maybe send a PR along for that, @axif0, and then I'll add any other docs changes to your PR and then we can do the new release? :)

Copy link
Copy Markdown
Collaborator

@DeleMike DeleMike left a comment

Choose a reason for hiding this comment

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

Thanks so much for this PR @axif0 !

I have been going through it. All is well. 🎯🚀

I updated logging in server.go, the API docs and corrected a string encoding issue.

One thing I could not test is a success state for the endpoint. I noticed it is probably because of the type of TranslationData.sqlite I have installed locally. Should that be an issue?

See my logs:

MariaDB [scribe_test]> SELECT * FROM ENLanguageDataVerbsScribe LIMIT 10;
+------------+----------------------------------+---------------------------+---------------------+----------+---------------------+------------------+
| wdLexemeId | simplePresentThirdPersonSingular | combinedPresentParticiple | lastModified        | lexemeID | simplePast          | simplePresent    |
+------------+----------------------------------+---------------------------+---------------------+----------+---------------------+------------------+
| L4         | windsurfs                        | windsurfing               | 2025-06-02 12:58:33 | L4       | windsurfed          | windsurf         |
| L9         | creates                          | creating                  | 2025-05-15 16:56:40 | L9       | created             | create           |
| L25        | strengthens                      | strengthening             | 2025-05-15 17:40:07 | L25      | strengthened        | strengthen       |
| L53        | asks                             | asking                    | 2025-09-18 20:24:59 | L53      | asked               | ask              |
| L67        | interrogates                     | interrogating             | 2025-06-19 20:13:36 | L67      | interrogated        | interrogate      |
| L104       | rebuilds                         | rebuilding                | 2025-06-05 20:25:30 | L104     | rebuilt             | rebuild          |
| L108       | detects                          | detecting                 | 2025-06-05 20:33:38 | L108     | detected            | detect           |
| L119       | normalizes | norms               | normalizing | norming     | 2025-07-17 20:16:15 | L119     | normalized | normed | norm | normalize |
| L122       | abbreviates                      | abbreviating              | 2025-09-18 20:13:44 | L122     | abbreviated         | abbreviate       |
| L126       | extracts                         | extracting                | 2025-06-19 20:13:31 | L126     | extracted           | extract          |
+------------+----------------------------------+---------------------------+---------------------+----------+---------------------+------------------+

MariaDB [scribe_test]> SHOW TABLES;
+---------------------------+
| Tables_in_scribe_test     |
+---------------------------+
| DELanguageDataNounsScribe |
| DELanguageDataVerbsScribe |
| ENLanguageDataNounsScribe |
| ENLanguageDataVerbsScribe |
| ESLanguageDataNounsScribe |
| ESLanguageDataVerbsScribe |
| FRLanguageDataNounsScribe |
| FRLanguageDataVerbsScribe |
| ITLanguageDataNounsScribe |
| ITLanguageDataVerbsScribe |
| PTLanguageDataNounsScribe |
| PTLanguageDataVerbsScribe |
| RULanguageDataNounsScribe |
| RULanguageDataVerbsScribe |
| SVLanguageDataNounsScribe |
| SVLanguageDataVerbsScribe |
| TranslationDataEnglish    |
| TranslationDataFrench     |
| TranslationDataGerman     |
| TranslationDataItalian    |
| TranslationDataPortuguese |
| TranslationDataRussian    |
| TranslationDataSpanish    |
| TranslationDataSwedish    |
+---------------------------+
24 rows in set (0.004 sec)

When I did migration, I had this:

2026/05/06 12:20:52 Migrated 5000 rows for table TranslationDataSwedish
2026/05/06 12:20:52 Migrated 10000 rows for table TranslationDataSwedish
2026/05/06 12:20:53 Migrated 15000 rows for table TranslationDataSwedish
2026/05/06 12:20:53 Migrated 20000 rows for table TranslationDataSwedish
2026/05/06 12:20:53 Migrated 25000 rows for table TranslationDataSwedish
2026/05/06 12:20:53 Migrated 30000 rows for table TranslationDataSwedish
2026/05/06 12:20:53 Migrated 35000 rows for table TranslationDataSwedish
2026/05/06 12:20:54 Migrated 40000 rows for table TranslationDataSwedish

How can I see the success state?

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.

Add translations API endpoints Add MariaDB tables for translations

3 participants