Esporta testo personalizzato dal database in YML

Admin interface allows overwriting any stranslations which is very healful not just for utilizing community translation while updating them with custom phrases that suit a specific community, but at the same time it is also a very good way to gradually translate a new language, without the need of updating the code, hence rebuilding the cache. However, it would be great if the customized translations can be exported from the database and somehoe merged back into the corresponding YAML files to make it available in the main repository. Is there a way of doing that which I am not aware of?

3 Mi Piace

I don’t think there is a job for this but 100% support these two tasks, which could help you out here

rake export:locale_overrides:server > server.xx.yml
rake export:locale_overrides:client > client.xx.yml
7 Mi Piace

Qualcuno sa se qualcuno l’ha già fatto?

@sam Ho eseguito l’attività per esportare i locali ma non funziona
Ho il messaggio qui sotto

Non so come creare l'attivitĂ  'export:locale_overrides:server' (Vedi l'elenco delle attivitĂ  disponibili con `rake --tasks`)

Qualche idea?

Nessuno ha ancora svolto il compito, aggiungerò un pr-welcome per chiarezza

2 Mi Piace

Questo è qualcosa a cui ho pensato anch’io e ho creato una PR:

3 Mi Piace

Per chiudere il cerchio, io e @mqmenchaca abbiamo lavorato su questo contemporaneamente senza sapere che l’altro ci stesse lavorando. E siamo arrivati a delle PR a poche ore di distanza! Avevo già unito la mia PR a core poco prima di vedere quella di Max, quindi purtroppo non possiamo unire il suo lavoro in core. Apprezzo molto il contributo, @mqmenchaca!

Il commit che aggiunge questa funzionalità è questo: DEV: Add a rake task to export/import translation overrides (#18487) ¡ discourse/discourse@4d80110 ¡ GitHub

Per esportare, esegui bin/rake export:translation_overrides (creerĂ  un file JSON con le sovrascritture).

Per importare in un’istanza separata, copia il file JSON esportato lì ed esegui bin/rake import:file[\"nomefile\"].

4 Mi Piace

Ciao. Per favore, puoi descrivere i passaggi per eseguirlo?

./launcher enter app
bin/rake export:translation_overrides

Restituisce:

rake aborted!
ActiveRecord::NoDatabaseError: Non è stato possibile trovare il tuo database: discourse. Che si trova nel file di configurazione del database situato in config/database.yml

Sembra essere un problema con il tuo ambiente. Quando entro nel container nella mia istanza self-hosted, posso eseguire comandi rake senza problemi.

1 Mi Piace

Sto usando Discourse dietro Nginx, questo potrebbe essere correlato? È possibile usare il comando usando un database esterno al container?

OK, stavo facendo dei test e ho il file esportato.

Se modifico quel file cambiando es_XX in es (e nient’altro, prestando attenzione al formato e alla codifica dei caratteri del file) e importando il file precedentemente esportato, dovrebbe funzionare?

Voglio spostare le sovrascritture precedenti nella lingua es predefinita sulla nostra istanza :slight_smile: