# מה הדרך הטובה ביותר לאחזר (ולכתוב) מחרוזות טקסט מותאמות אישית לתרגומים באופן פרוגרמטי?

**URL:** https://meta.discourse.org/t/whats-the-best-way-to-programmatically-fetch-and-write-customized-text-strings-for-translations/258859
**Category:** Support
**Created:** [21 במרץ,‏ 2023,‏ 9:37am UTC](https://meta.discourse.org/t/whats-the-best-way-to-programmatically-fetch-and-write-customized-text-strings-for-translations/258859 "2023-03-21T09:37:53Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [21 במרץ,‏ 2023,‏ 9:37am UTC](https://meta.discourse.org/t/whats-the-best-way-to-programmatically-fetch-and-write-customized-text-strings-for-translations/258859/1 "2023-03-21T09:37:53Z")

</div>

I have used the web admin interface to change quite a few Discourse strings. Out of expediency\[1\] I have ignored the non-English versions. This means, of course, that they’re out of sync.

In Fedora, we use Weblate for community-powered translations. (See [https://translate.fedoraproject.org/](https://translate.fedoraproject.org/)). I’d love to hook this up, ideally so that there’s an entirely automatic workflow where when a string is updated in English via the admin interface, it is sent to Weblate, and when there is a translation, it comes back.

What’s the best way to accomplish this?

* * *

1. laziness.

---

<div class="post-metadata">

### Author: ![Danielle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danielle/32/537380_2.png) [@Danielle](https://meta.discourse.org/u/Danielle)
#### Post date: [29 במרץ,‏ 2023,‏ 12:54pm UTC](https://meta.discourse.org/t/whats-the-best-way-to-programmatically-fetch-and-write-customized-text-strings-for-translations/258859/4 "2023-03-29T12:54:07Z")

</div>

> [@mattdm](#):
>
> What’s the best way to accomplish this?

Implementing an integration using our API where you would:

- Poll Discourse for new overrides (no webhooks)
- Push new translations from Weblate into your Discourse site.

That’s the preliminary rundown. We’re looking into quantifying the existing limitations, as our current API returns only a fixed amount of translation overrides. Which means we would need to make changes to that API endpoint to make it work.

---

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [30 במרץ,‏ 2023,‏ 3:09am UTC](https://meta.discourse.org/t/whats-the-best-way-to-programmatically-fetch-and-write-customized-text-strings-for-translations/258859/5 "2023-03-30T03:09:17Z")

</div>

Polling seems fine — translation won’t be instant anyway. But does the polling _thing_ need to keep track in some way? It’s nice when it can be stateless…

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [4 באפריל,‏ 2023,‏ 1:25pm UTC](https://meta.discourse.org/t/whats-the-best-way-to-programmatically-fetch-and-write-customized-text-strings-for-translations/258859/8 "2023-04-04T13:25:34Z")

</div>

There’s no need to keep track of anything on your site. You should be able to implement it stateless.

- For polling, you need to send a `GET` request to the following path on your site:  
`/admin/customize/site_texts.json?locale=en&overridden=true&page=0`

- Updating a translation override works by sending a `PUT` request to the following path:  
`/admin/customize/site_texts/<id>`

Essentially you need to use the same API calls that the Customize Text admin interface uses.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [4 במאי,‏ 2023,‏ 1:25pm UTC](https://meta.discourse.org/t/whats-the-best-way-to-programmatically-fetch-and-write-customized-text-strings-for-translations/258859/9 "2023-05-04T13:25:53Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
