You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The document downloaded through h@h will contain a galleryinfo.txt file, which contains gallery-related tags.
Here is a project that maps original english to Chinese, which contains a json dataset : EhTagTranslation
Can an option or plugin be added to automate the translation?
I tried to write a function to achieve it.
sub translate_tag_to_cn {
my $logger = get_plugin_logger();
my ($list, $temp) = @_;
my $filename = "/home/koyomi/lanraragi/database/db.text.json"; # json file path
my $json_text = do {
open(my $json_fh, "<", $filename)
or $logger->debug("Can't open $filename: $!\n");
local $/;
<$json_fh>;
};
my $json = decode_json($json_text);
my $target = $json->{'data'};
for my $item (@$list) {
my ($namespace, $key) = split(/:/, $item);
$namespace =~ s/^\s+//;
$key =~ s/\s+$//;
$logger->debug("name is !$namespace! key is !$key! $item");
for my $element (@$target) {
# if $namespace is same with 'namespace',repleacement
if ($element->{'namespace'} eq $namespace) {
my $name = $element->{'frontMatters'}->{'name'};
$item =~ s/$namespace/$name/;
my $data = $element->{'data'};
if (exists $data->{$key}) {
my $value = $data->{$key}->{'name'};
$item =~ s/$key/$value/;
}
last;
}
}
}
return $list;
}
The text was updated successfully, but these errors were encountered:
Tag rules in the intended method for auto-replacing incoming tags.
I'm aware it'd be annoying to cram an entire database of translated tags into tag rules, so maybe there's a potential feature in being able to set arbitrary jsons as "tag replacement sources" or something.
In the meantime, all I can recommend would be a script-type plugin that goes through the entire DB and replaces according to your translation DB.
I wrote a plugin ChineseTagTranslator.pm using ChatGPT that translates the stored English tags into Chinese and adds them to the metadata. However, this plugin does not implement the feature to delete English tags because LRR does not currently support sorting for non-English tags (issue #946).
If you need to delete English tags, you can consider using the Tag Rule feature. The following rule can be used to remove all English tags except for Data_added:
By the way, The reason for excluding the date_added tag is that after changing the namespace to Chinese, the timestamp is no longer able to display in the year/month/day format. I suspect this might be related to HTML, but unfortunately, I am not familiar with HTML. I hope someone can work on this adaptation.
The document downloaded through h@h will contain a galleryinfo.txt file, which contains gallery-related tags.
Here is a project that maps original english to Chinese, which contains a json dataset : EhTagTranslation
Can an option or plugin be added to automate the translation?
I tried to write a function to achieve it.
The text was updated successfully, but these errors were encountered: