I have a simple project that used json for translation files. After looking through the supported formats I chose the “Chrome JSON” app, as it is a standard and says it supports context. But my context data (using “description” keys) is ignored. Is this a bug, and if so, how do I report it so it can get fixed? If it is expected behavior then I think the documentation for that app should be updated to clarify that per-key context is not supported.
Hi @r-owen ,
The “description” values should be supported in the Chrome JSON format. Your file needs to have the following structure:
{
"appName": {
"message": "string 1",
"description": "context_1"
},
"extName": {
"message": "string 2",
"description": "context_2"
},
"extDesc": {
"message": "string 3",
"description": "context_3"
}
}
Oh good. That is the way I read it, too. But it is not working for me – the strings to translate are present, but the context is the keys, not the descriptions I specify. My project is Base Loom Server (use “base-loom-server” in the URL) and it is public. Here is an extract from the only source file:
"another client took control": {
"message": "another client took control",
"description": "Displayed if another web client takes the connection"
},
"At start of threading": {
"message": "At start of threading",
"description": "Displayed if you try to undo threading past the beginning"
},
Unless I am missing something, I am using the correct format (it is true that in most cases my keys are a copy of my phrases to translate, but I can’t imagine how that could confuse the Chrome JSON app). Which is why I think the “Chrome JSON” app may have a bug.
It is a very nice format and I would love to use it. But I really want the context to be displayed.
Is there some way to see which format crowdin thinks a given source file uses (and change it if crowdin guessed wrong)? I haven’t seen anything like that.
Hi @r-owen !
I’ve checked the project and can see that the file was parsed as expected. Since the context can’t be added as a key, the string is displayed from the “message” and the “description” part is displayed in the context section for both examples
Kindly follow the URLs below:
You may consider using a .json with key-value mapping and additional field for the text comments: Translate JSON Files Online
What I am trying to accomplish is to display the context strings in the list of strings to be translated: as the grayed out text just below each entry that shows the phrase to be translated to the left and the translation to the right, as in this screen shot, which shows three entries from the Danish translation:
Is there a way to do that with the “Chrome JSON” format? If not, is there a different JSON format I can use where it will work? (And if so, a pointer to instructions on how to change the format of an existing source file would be appreciated. I tried one different format – “JSON with context”, which is a trivial variation of “Chrome JSON” format – and upload failed.)
(I’m afraid I don’t understand what you mean by “the context can’t be added as a key”. But I don’t want to waste anybody’s time more than i am already doing.)
Hi @r-owen
Technically, you’re doing everything correctly, but the thing is, context is not something that should be translated. Regardless of format, you need to use Source strings to specify the text that needs translation, so basically, it’s a translatable element.
While it’s important, it is still optional, as Context adds additional information to help translators understand the intended meaning. Like a description, some extra info, etc.
If we look at your sample file, JSON with context will have the same logic as Chrome JSON:
this is a key -> "another client took control"
this is a source text -> "message": "another client took control"
this is context -> "description": "Displayed if another web client takes the connection"
I don’t want the context to be translated. I just want it displayed (in English) below the phrase to be translated – the gray text in the screen shot in my previous post. What can I do to make this happen? Preferably as part of a JSON source file? (I think I can hand edit every context string, but that is a lot of work to add and maintain).
I am willing to upload an adjunct file if that is what’s necessary. I am already post-processing the translations. I can also pre-process the source file(s).
But I am also submitting a feature request: that “Chrome JSON” behave as requested: show the untranslated context from the source file as the gray text in the screen shot (perhaps with a configurable switch, if not everybody wants that).
Hi @r-owen !
The context is designed in order not to be translated. It is a source of additional information or explanation. If you want to upload the JSON with context, please install the following app and make sure that your source file has the needed structure as described here:
Then once the app is installed and the file is uploaded, the context will be displayed under the Context field:
Best regards,
I tried uploading a new file “test.json” in the “JSON with context” format. It includes 2 of the fields copied from my “Chrome JSON” “default.text”, with the new field names:
{
"Back to front": {
"text": "Back to front",
"crowdinContext": "Setting to thread from the back of the loom to the front"
},
"cannot jump": {
"text": "cannot jump",
"crowdinContext": "Part of an error messsage: cannot perform the requested jump"
}
}
I then configured the “JSON with context” app (which I had already installed). For step 1 I picked language “Acholi”. I did not see how to do step 2; I’m using your default editor and am not aware of you exposing any javascript for that. (Watching the video was…interesting. It show an editing app that seems to be customized possibly running outside of crowdin.)
I was then able to download the Acholi file and look at it. Here is a snippet:
"Back to front": {
"message": "crwdns271:0crwdne271:0",
"description": "Setting to thread from the back of the loom to the front"
},
"cannot jump": {
"message": "crwdns391:0crwdne391:0",
"description": "Part of an error messsage: cannot perform the requested jump"
},
The auto-generated keys look plausibly like the app docs said they should. I’m a bit surprised it’s in my desired “Chrome JSON” format instead of “JSON with context” format, leaving me to wonder if my “test.json” is doing anything, though it does get downloaded along with Acholi when I download that translation, so it is being noticed.)
Unfortunately I still am not seeing context in-line in the editor, for the two phrases in “test.json” or any other. Here are two screen shots of the two fields that are in both source files: In Danish. First “test.json”:
And the same two fields from default.json:
The gray should-be-context text is still wrong (identically so, except test.data has the word “.text” appended).
I still feel like this should “just work”, with crowdin’s editor offering to translate only the “message” fields, while providing the “description” fields as context (in English) – perhaps as a configurable option in the “Chrome JSON” app.
Hi @r-owen
The context from the Chrome JSON file is uploaded and visible in the Editor, I’ve tested once again with the sample file:
To see the full context in the Side-by-Side editor view, please switch to the Translations right side panel as in the screenshot below:
By default, it is possible to see the source string and key in the source string section
OK. Sounds like I was doing all I could all along. Sorry to waste everybody’s time. We may as well close this.
I’ll file another ticket asking for what I want.