This commit is contained in:
crschnick 2024-04-19 07:52:59 +00:00
parent 60413b7de8
commit 385068a3de
3 changed files with 15 additions and 9 deletions

View file

@ -90,10 +90,6 @@ public class AppI18n {
private static String getCallerModuleName() {
var callers = CallingClass.INSTANCE.getCallingClasses();
for (Class<?> caller : callers) {
if (caller.isSynthetic()) {
continue;
}
if (caller.equals(CallingClass.class)
|| caller.equals(ModuleHelper.class)
|| caller.equals(ModalOverlayComp.class)

View file

@ -1,5 +1,6 @@
package io.xpipe.core.util;
import com.fasterxml.jackson.databind.*;
import io.xpipe.core.dialog.BaseQueryElement;
import io.xpipe.core.dialog.BusyElement;
import io.xpipe.core.dialog.ChoiceElement;
@ -13,10 +14,6 @@ import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.jsontype.NamedType;
import com.fasterxml.jackson.databind.module.SimpleModule;
@ -99,6 +96,15 @@ public class CoreJacksonModule extends SimpleModule {
@Override
public ShellDialect deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
var tree = JacksonMapper.getDefault().readTree(p);
if (tree.isObject()) {
var t = (JsonNode) tree.get("type");
if (t == null) {
return null;
}
return ShellDialects.byNameIfPresent(t.asText()).orElse(null);
}
return ShellDialects.byNameIfPresent(p.getValueAsString()).orElse(null);
}
}

View file

@ -19,12 +19,16 @@ has to be transformed into
#custom
key=Correct translation
```
to mark it being a custom string that should be kept.
to mark it being a custom string that should be kept. It is important to include the `#custom` annotation.
### Correcting texts
If you want to correct something in a text in a `.md` file, you don't have to do anything special as these are not being overwritten later on. Just perform and submit your changes.
### Improving automatic translations
If a string translated from english is wrong in many languages, it might also make sense to adjust the initial translation and context setting to improve the automatic translation. It is possible to augment the original english string and regenerate the translations for that by adding a `#context: ...` annotation to an original english string that is not translated correctly to improve the accuracy. You will already see some english strings that have this information added.
### Trying them out in action
If you have cloned this repository, you can automatically run a developer build of XPipe by following the instructions in the [contribution guide](/CONTRIBUTING.md). This will use your modified translations, so you can see how they look and behave in practice.