mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-22 03:49:27 +01:00
Handle translations a little better
This commit is contained in:
parent
e1553aa912
commit
7eef390756
@ -137,3 +137,24 @@ They receive the response with the same label, so they can match the sent comman
|
||||
In order to allow this, in command handlers we don't send responses directly back to the user. Instead, we buffer the responses in an object called a ResponseBuffer. When the command handler returns, the contents of the ResponseBuffer is sent to the user with the appropriate label (and batches, if they're required).
|
||||
|
||||
Basically, if you're in a command handler and you're sending a response back to the requesting client, use `rb.Add*` instead of `client.Send*`. Doing this makes sure the labeled responses feature above works as expected. The handling around `PRIVMSG`/`NOTICE`/`TAGMSG` is strange, so simply defer to [irctest](https://github.com/DanielOaks/irctest)'s judgement about whether that's correct for the most part.
|
||||
|
||||
|
||||
## Updating Translations
|
||||
|
||||
We support translating server strings using [CrowdIn](https://crowdin.com/project/oragono)! To send updated source strings to CrowdIn, you should:
|
||||
|
||||
1. `cd` to the base directory (the one this `DEVELOPING` file is in).
|
||||
2. Install the `pyyaml` and `docopt` deps using `pip3 install pyyamp docopt`.
|
||||
3. Run the `updatetranslations.py` script with: `./updatetranslations.py irc languages`
|
||||
4. Install the [CrowdIn CLI tool](https://support.crowdin.com/cli-tool/).
|
||||
5. Make sure the CrowdIn API key is correct in `~/.crowdin.yaml`
|
||||
6. Run `crowdin upload sources`
|
||||
|
||||
We also support grabbing translations directly from CrowdIn. To do this:
|
||||
|
||||
1. `cd` to the base directory (the one this `DEVELOPING` file is in).
|
||||
2. Install the [CrowdIn CLI tool](https://support.crowdin.com/cli-tool/).
|
||||
3. Make sure the CrowdIn API key is correct in `~/.crowdin.yaml`
|
||||
4. Run `crowdin download`
|
||||
|
||||
This will download a bunch of updated files. The `INFO` command should be used to see whether the credits strings has been updated/translated properly, since that can be a bit of a sticking point for our wonderful translators :)
|
||||
|
10
crowdin.yml
10
crowdin.yml
@ -23,30 +23,30 @@ files: [
|
||||
},
|
||||
{
|
||||
"source" : "languages/example/irc.lang.json",
|
||||
"translation" : "languages/%locale%-irc.lang.yaml",
|
||||
"translation" : "languages/%locale%-irc.lang.json",
|
||||
"dest" : "irc.lang.json"
|
||||
},
|
||||
{
|
||||
"source" : "languages/example/help.lang.json",
|
||||
"translation" : "languages/%locale%-help.lang.yaml",
|
||||
"translation" : "languages/%locale%-help.lang.json",
|
||||
"dest" : "help.lang.json",
|
||||
"update_option" : "update_as_unapproved",
|
||||
},
|
||||
{
|
||||
"source" : "languages/example/chanserv.lang.json",
|
||||
"translation" : "languages/%locale%-chanserv.lang.yaml",
|
||||
"translation" : "languages/%locale%-chanserv.lang.json",
|
||||
"dest" : "services/chanserv.lang.json",
|
||||
"update_option" : "update_as_unapproved",
|
||||
},
|
||||
{
|
||||
"source" : "languages/example/nickserv.lang.json",
|
||||
"translation" : "languages/%locale%-nickserv.lang.yaml",
|
||||
"translation" : "languages/%locale%-nickserv.lang.json",
|
||||
"dest" : "services/nickserv.lang.json",
|
||||
"update_option" : "update_as_unapproved",
|
||||
},
|
||||
{
|
||||
"source" : "languages/example/hostserv.lang.json",
|
||||
"translation" : "languages/%locale%-hostserv.lang.yaml",
|
||||
"translation" : "languages/%locale%-hostserv.lang.json",
|
||||
"dest" : "services/hostserv.lang.json",
|
||||
"update_option" : "update_as_unapproved",
|
||||
},
|
||||
|
@ -697,12 +697,13 @@ func LoadConfig(filename string) (config *Config, err error) {
|
||||
return nil, fmt.Errorf("Cannot have language file with code 'en' (this is the default language using strings inside the server code). If you're making an English variant, name it with a more specific code")
|
||||
}
|
||||
|
||||
if langInfo.Code == "" || langInfo.Name == "" || langInfo.Contributors == "" {
|
||||
return nil, fmt.Errorf("Code, name or contributors is empty in language file [%s]", name)
|
||||
if len(langInfo.Translations) == 0 {
|
||||
// skip empty translations
|
||||
continue
|
||||
}
|
||||
|
||||
if len(langInfo.Translations) == 0 {
|
||||
return nil, fmt.Errorf("Language [%s / %s] contains no translations", langInfo.Code, langInfo.Name)
|
||||
if langInfo.Code == "" || langInfo.Name == "" || langInfo.Contributors == "" {
|
||||
return nil, fmt.Errorf("Code, name or contributors is empty in language file [%s]", name)
|
||||
}
|
||||
|
||||
// check for duplicate languages
|
||||
|
Loading…
Reference in New Issue
Block a user