번역 전체 교체

:information_source: Summary This plugin allows you to globally replace certain words in the translation
:hammer_and_wrench: Repository Link https://github.com/Lhcfl/replace-translations-global
:open_book: Install Guide How to install plugins in Discourse

Features

Literally, replace all occurrences of a word with another word

For example, replace “Topic” with “Nya”:

Configuration

I believe its settings are self-explanatory :slightly_smiling_face:

Note that translations are cached and changing them takes time. You can do this to force update:

sudo ./launcher enter app
rm -rf tmp
14개의 좋아요

Can this replace the official custom text?

This is the problem I’m currently encountering: I cannot modify those key-values in bulk!

Or @Lhc_fl do you have a better method?

This plugin is used for batch replacement of translations. However, due to caching, you may need to rebuild after replacement for it to take effect.

Is there no batch modification method provided by Discourse itself? For example, exporting a YAML file and replacing it via VS Code?

There is no such method, you can only change them one by one

Then your tools are indeed very good!

Does every change require a manual rebuild with ./launcher rebuild app?
sudo ./launcher enter app
rm -rf tmp
I haven’t found its use.

Try ./launcher restart app first (after deleting tmp)?

I deleted tmp in the development environment, so it might have been automatically applied here.

If that doesn’t work, try rebuilding. The language files might be pre-compiled, and the plugin’s mechanism interferes with the function that reads the language yml, running only on the first load.

1개의 좋아요

Just a reminder that including an English translation makes it much easier for others to follow along, :pray:

4개의 좋아요

I just tried it, and it will oops, it’s better to rebuild it to be stable.

이 기능을 category 용어의 대용으로 사용할 경우, 이 플러그인이 {category}와 같은 템플릿 내의 해당 단어까지 대체하여 UI에서 오류가 발생할 수 있음을 주의해야 합니다. 이를 방지하기 위해 플러그인 설정에서 en:(?<!\{)category(?!\})=>chapter라는 정규식을 사용 중이지만, 플러그인이 사용자 노출 콘텐츠에만 적용되도록 조정되어야 할 것입니다.

3개의 좋아요

@Lhc_fl 이 부분에 대한 계획이 있나요? 귀하의 플러그인은 제 커뮤니티의 프랑스어 용어를 수정하는 데 필요한 것 같지만, tomtjes가 위 게시물에서 설명한 대로 문제가 발생할까 봐 걱정됩니다.

왜 치환이 성공하지 않나요?

(이것은 Globally replace translations 플러그인입니다)

화살표가 => 기호를 사용하여 =>처럼 보이는지 확인해 보세요. 스크린샷에 있는 화살표가 올바르게 보이지 않습니다.

기호 사용에는 문제가 없습니다. =와 > 기호가 각각 독립적으로 사용되었지만, 표시상의 문제로 인해 붙어 있는 것처럼 보입니다.

1개의 좋아요

알겠습니다. 어쨌든 이 내용은 해당 플러그인 토픽으로 옮기는 것이 적절합니다. official 채널이 아니기 때문입니다.

네, 알겠습니다. 알려주셔서 감사합니다. (왜 20자 이상 채워야만 답변을 보낼 수 있나요?)

코드를 올바르게 이해했다면, 이 플러그인은 JsLocaleHelper를 사용하여 프론트엔드에서 사용되는 텍스트(client.*.yml의 내용)를 치환합니다. 사이트 설정 설명 등이 포함된 server.*.yml은 변경되지 않습니다.

azy videos”라는 것은 이 플러그인을 사용하려는 용도의 예시인가요? 이 플러그인은 대량의 텍스트 내에서 특정 용어를 치환하도록 설계되었습니다. 해당 텍스트가 포럼에 단 한 번만 나타나므로, 플러그인을 사용하지 않고 텍스트를 직접 수정하는 것이 좋습니다. 이를 위한 가이드가 있습니다: Customize text in Discourse

2개의 좋아요

이 영문 텍스트를 수정하고 싶은데 검색이 안 돼요.


1개의 좋아요

그것들은 설정의 이름들입니다. 왜 번역할 수 없는지에 대한 설명은 有没有比较好的中文插件 - #2 by Moin 에서 했습니다.

관리자 인터페이스에서는 번역할 수 없는 텍스트를 사용자 지정할 수 없습니다.

참고로, 이 플러그인이 백엔드 텍스트도 수정할 수 있는 기능에 대해 제가 놓친 부분이 있다면, 여전히 이 플러그인이 번역 가능한 텍스트만 변경하고 인터페이스의 다른 텍스트는 변경하지 않는다고 확신합니다. 이는 텍스트 내의 단어를 교체하는 것에 관한 것이지, 번역할 수 없는 텍스트의 번역을 허용하는 것이 아닙니다.

2개의 좋아요