[66] update translation

pull/1069/head
meisnate12 2 years ago
parent 5e51165958
commit 61c3ef648f

@ -1 +1 @@
1.17.3-develop65 1.17.3-develop66

@ -0,0 +1,37 @@
1.18.0 -> 1.18.0.1
added library_type
added key_names
added comments
imdb_popular_summary: Changed `<<collection_name>>` to `IMDb Popular`
imdb_top_summary: Changed `<<collection_name>>` to `IMDb Top 250`
imdb_lowest_summary: Changed `<<collection_name>>` to `IMDb Lowest Rated`
actor_summary: Changed `<<library_type>>` to `<<library_typeU>>`
audio_language_summary: Changed `<<library_type>>` to `<<library_typeU>>`
audio_language_other_summary: Changed `<<library_type>>` to `<<library_typeU>>`
content_rating_name: Changed `<<library_type>>` to `<<library_typeU>>`
content_rating_summary: Changed `<<library_type>>` to `<<library_typeU>>`
content_rating_other_summary: Changed `<<library_type>>` to `<<library_typeU>>`
country_name: Changed `<<library_type>>` to `<<library_typeU>>`
country_summary: Changed `<<library_type>>` to `<<library_typeU>>`
country_other_summary: Changed `<<library_type>>` to `<<library_typeU>>`
director_summary: Changed `<<library_type>>` to `<<library_typeU>>`
genre_name: Changed `<<library_type>>` to `<<library_typeU>>`
genre_summary: Changed `<<library_type>>` to `<<library_typeU>>`
producer_summary: Changed `<<library_type>>` to `<<library_typeU>>`
resolution_name: Changed `<<library_type>>` to `<<library_typeU>>`
resolution_summary: Changed `<<library_type>>` to `<<library_typeU>>`
resolution_standards_name: Changed `<<library_type>>` to `<<library_typeU>>`
resolution_standards_summary: Changed `<<library_type>>` to `<<library_typeU>>`
resolution_standards_other_summary: Changed `<<library_type>>` to `<<library_typeU>>`
seasonal_name: Changed `<<library_type>>` to `<<library_typeU>>`
streaming_name: Changed `<<library_type>>` to `<<library_typeU>>`
streaming_summary: Changed `<<library_type>>` to `<<library_typeU>>`
studio_summary: Changed `<<library_type>>` to `<<library_typeU>>`
subtitle_language_summary: Changed `<<library_type>>` to `<<library_typeU>>`
subtitle_language_other_summary: Changed `<<library_type>>` to `<<library_typeU>>`
writer_summary: Changed `<<library_type>>` to `<<library_typeU>>`
year_summary: Changed `<<library_type>>` to `<<library_typeU>>`

@ -1,4 +1,17 @@
version: 1.18.0 version: 1.18.0
library_type:
# For Movie Libraries
movie: movie
# For Show Libraries
show: show
# For Music Libraries
artist: artist
# For Other Video Libraries
video: video
# For Playlists
item: item
key_names:
translations: translations:
############################################################# #############################################################
# Award # # Award #
@ -7,24 +20,28 @@ translations:
bafta_best_name: BAFTA Best Films bafta_best_name: BAFTA Best Films
bafta_best_summary: British Academy of Film and Television Arts Best Film Winners. bafta_best_summary: British Academy of Film and Television Arts Best Film Winners.
# example key_name: 2022
bafta_year_name: BAFTA <<key_name>> bafta_year_name: BAFTA <<key_name>>
bafta_year_summary: <<key_name>> BAFTA Awards. bafta_year_summary: <<key_name>> BAFTA Awards.
cannes_best_name: Cannes Golden Palm Winners cannes_best_name: Cannes Golden Palm Winners
cannes_best_summary: Cannes Golden Palm Winners. cannes_best_summary: Cannes Golden Palm Winners.
# example key_name: 2022
cannes_year_name: Cannes <<key_name>> cannes_year_name: Cannes <<key_name>>
cannes_year_summary: <<key_name>> Cannes Awards. cannes_year_summary: <<key_name>> Cannes Awards.
choice_year_name: Critics Choice Awards <<key_name>> choice_year_name: Critics Choice Awards <<key_name>>
choice_year_summary: <<key_name>> Critics Choice Awards. choice_year_summary: <<key_name>> Critics Choice Awards.
# example key_name: 2022
emmy_year_name: Emmys <<key_name>> emmy_year_name: Emmys <<key_name>>
emmy_year_summary: <<key_name>> Emmy Winners. emmy_year_summary: <<key_name>> Emmy Winners.
golden_best_name: Golden Globe Best Motion Pictures golden_best_name: Golden Globe Best Motion Pictures
golden_best_summary: Golden Globe Best Motion Pictures. golden_best_summary: Golden Globe Best Motion Pictures.
# example key_name: 2022
golden_year_name: Golden Globe <<key_name>> golden_year_name: Golden Globe <<key_name>>
golden_year_summary: <<key_name>> Golden Globe Winners. golden_year_summary: <<key_name>> Golden Globe Winners.
@ -34,6 +51,7 @@ translations:
oscars_director_name: Oscars Best Director Winners oscars_director_name: Oscars Best Director Winners
oscars_director_summary: The Academy Award for Best Director is one of the Academy Awards presented annually by the Academy of Motion Picture Arts and Sciences since the awards debuted in 1929. oscars_director_summary: The Academy Award for Best Director is one of the Academy Awards presented annually by the Academy of Motion Picture Arts and Sciences since the awards debuted in 1929.
# example key_name: 2022
oscars_year_name: Oscars Winners <<key_name>> oscars_year_name: Oscars Winners <<key_name>>
oscars_year_summary: Academy Awards (Oscars) Winners for <<key_name>>. oscars_year_summary: Academy Awards (Oscars) Winners for <<key_name>>.
@ -49,12 +67,14 @@ translations:
venice_best_name: Venice Golden Lions venice_best_name: Venice Golden Lions
venice_best_summary: The Venice Film Festival is the oldest film festival in the world. Founded 1932, the festival has since taken place every year in Venice, Italy. It is part of the Venice Biennale, a major biennial exhibition and festival for contemporary art. The festival's Leone d'Oro (Golden Lion) prize is awarded to the best film screened at the festival. venice_best_summary: The Venice Film Festival is the oldest film festival in the world. Founded 1932, the festival has since taken place every year in Venice, Italy. It is part of the Venice Biennale, a major biennial exhibition and festival for contemporary art. The festival's Leone d'Oro (Golden Lion) prize is awarded to the best film screened at the festival.
# example key_name: 2022
spirit_year_name: Independent Spirit Awards <<key_name>> spirit_year_name: Independent Spirit Awards <<key_name>>
spirit_year_summary: <<key_name>> Independent Spirit Awards. spirit_year_summary: <<key_name>> Independent Spirit Awards.
sundance_best_name: Sundance Grand Jury Winners sundance_best_name: Sundance Grand Jury Winners
sundance_best_summary: The Sundance Film Festival is a film festival that takes place annually in the state of Utah, in the United States. It is the largest independent cinema festival in the U.S. Held in January, the festival is the premier showcase for new work from American and international independent filmmakers. The festival comprises competitive sections for American and international dramatic and documentary films, both feature-length films and short films, and a group of non-competitive showcase sections. sundance_best_summary: The Sundance Film Festival is a film festival that takes place annually in the state of Utah, in the United States. It is the largest independent cinema festival in the U.S. Held in January, the festival is the premier showcase for new work from American and international independent filmmakers. The festival comprises competitive sections for American and international dramatic and documentary films, both feature-length films and short films, and a group of non-competitive showcase sections.
# example key_name: 2022
sundance_year_name: Sundance Film Festival <<key_name>> sundance_year_name: Sundance Film Festival <<key_name>>
sundance_year_summary: Sundance Film Festival of <<key_name>>. sundance_year_summary: Sundance Film Festival of <<key_name>>.
@ -80,17 +100,18 @@ translations:
basic_episodes_name: New Episodes basic_episodes_name: New Episodes
basic_episodes_summary: A collection of newly-released <<library_type>>s. basic_episodes_summary: A collection of newly-released <<library_type>>s.
# possible key_name: Netflix, Disney, HBO, Hulu, Paramount Plus, Prime Video
flixpatrol_name: <<key_name>> Top <<limit>> flixpatrol_name: <<key_name>> Top <<limit>>
flixpatrol_summary: Top <<limit>> <<library_type>>s on <<key_name>> according to FlixPatrol. flixpatrol_summary: Top <<limit>> <<library_type>>s on <<key_name>> according to FlixPatrol.
imdb_popular_name: IMDb Popular imdb_popular_name: IMDb Popular
imdb_popular_summary: List of <<collection_name>> <<library_type>>s. imdb_popular_summary: List of IMDb Popular <<library_type>>s.
imdb_top_name: IMDb Top 250 imdb_top_name: IMDb Top 250
imdb_top_summary: List of <<collection_name>> <<library_type>>s. imdb_top_summary: List of IMDb Top 250 <<library_type>>s.
imdb_lowest_name: IMDb Lowest Rated imdb_lowest_name: IMDb Lowest Rated
imdb_lowest_summary: List of <<collection_name>> <<library_type>>s. imdb_lowest_summary: List of IMDb Lowest Rated <<library_type>>s.
mal_popular_name: MyAnimeList Popular mal_popular_name: MyAnimeList Popular
mal_popular_summary: A collection of the most popular Anime according to MyAnimeList. mal_popular_summary: A collection of the most popular Anime according to MyAnimeList.
@ -159,77 +180,85 @@ translations:
# Both # # Both #
############################################################# #############################################################
# example key_name: Robin Williams
actor_name: <<key_name>> actor_name: <<key_name>>
actor_summary: <<library_type>>s with <<key_name>>. actor_summary: <<library_typeU>>s with <<key_name>>.
# example key_name: English
audio_language_name: <<key_name>> Audio audio_language_name: <<key_name>> Audio
audio_language_summary: <<library_type>>s filmed in the <<key_name>> Language. audio_language_summary: <<library_typeU>>s filmed in the <<key_name>> Language.
audio_language_other_name: Other Audio audio_language_other_name: Other Audio
audio_language_other_summary: <<library_type>>s filmed in other uncommon Languages. audio_language_other_summary: <<library_typeU>>s filmed in other uncommon Languages.
content_rating_name: <<key_name>> <<library_type>>s # example key_name: TV-MA
content_rating_summary: <<library_type>>s that are rated <<key_name>>. content_rating_name: <<key_name>> <<library_typeU>>s
content_rating_summary: <<library_typeU>>s that are rated <<key_name>>.
content_rating_other_name: Other Ratings content_rating_other_name: Other Ratings
content_rating_other_summary: <<library_type>>s with other uncommon Ratings. content_rating_other_summary: <<library_typeU>>s with other uncommon Ratings.
country_name: <<key_name>> <<library_type>>s # example key_name: United States
country_summary: <<library_type>>s filmed in <<key_name>>. country_name: <<key_name>> <<library_typeU>>s
country_summary: <<library_typeU>>s filmed in <<key_name>>.
country_other_name: Other Countries country_other_name: Other Countries
country_other_summary: <<library_type>>s filmed in other uncommon Countries. country_other_summary: <<library_typeU>>s filmed in other uncommon Countries.
# example key_name: 2010s
decade_name: Best of <<key_name>> decade_name: Best of <<key_name>>
decade_summary: Top <<limit>> <<library_type>>s of the <<key_name>>. decade_summary: Top <<limit>> <<library_type>>s of the <<key_name>>.
# example key_name: 2010
decade_show_name: Best of <<key_name>>s decade_show_name: Best of <<key_name>>s
decade_show_summary: Top <<limit>> <<library_type>>s of the <<key_name>>s. decade_show_summary: Top <<limit>> <<library_type>>s of the <<key_name>>s.
# example key_name: Robin Williams
director_name: <<key_name>> (Director) director_name: <<key_name>> (Director)
director_summary: <<library_type>>s Directed by <<key_name>>. director_summary: <<library_typeU>>s Directed by <<key_name>>.
genre_name: <<key_name>> <<library_type>>s # example key_name: Action
genre_summary: <<library_type>>s that have the genre <<key_name>>. genre_name: <<key_name>> <<library_typeU>>s
genre_summary: <<library_typeU>>s that have the genre <<key_name>>.
# example key_name: Robin Williams
producer_name: <<key_name>> (Producer) producer_name: <<key_name>> (Producer)
producer_summary: <<library_type>>s Produced by <<key_name>>. producer_summary: <<library_typeU>>s Produced by <<key_name>>.
resolution_name: <<key_name>> <<library_type>>s # example key_name: 1080p
resolution_summary: <<library_type>>s that have the resolution <<key_name>>. resolution_name: <<key_name>> <<library_typeU>>s
resolution_summary: <<library_typeU>>s that have the resolution <<key_name>>.
resolution_standards_name: <<key_name>> <<library_type>>s # example key_name: 1080p
resolution_standards_summary: <<library_type>>s that have the resolution <<key_name>>. resolution_standards_name: <<key_name>> <<library_typeU>>s
resolution_standards_summary: <<library_typeU>>s that have the resolution <<key_name>>.
resolution_standards_other_name: Other Resolutions resolution_standards_other_name: Other Resolutions
resolution_standards_other_summary: <<library_type>>s that have other uncommon resolutions. resolution_standards_other_summary: <<library_typeU>>s that have other uncommon resolutions.
seasonal_name: <<key_name>> <<library_type>>s # possible key_names: New Year's Day, Valentine's Day, St. Patrick's Day, Easter, Mother's Day, Father's Day, Independence Day, Labor Day, Halloween, Thanksgiving, Christmas
seasonal_name: <<key_name>> <<library_typeU>>s
seasonal_summary: A collection of <<key_name>> <<library_type>>s that may relate to the season. seasonal_summary: A collection of <<key_name>> <<library_type>>s that may relate to the season.
streaming_name: <<key_name>> <<library_type>>s # possible key_names: All 4, Apple TV+, BET+, BritBox, Disney+, hayu, HBO Max, Hulu, Netflix, NOW, Paramount+, Peacock, Prime Video
streaming_summary: <<library_type>>s streaming on <<key_name>>. streaming_name: <<key_name>> <<library_typeU>>s
streaming_summary: <<library_typeU>>s streaming on <<key_name>>.
# example key_name: Studio Ghibli
studio_name: <<key_name>> studio_name: <<key_name>>
studio_summary: <<library_type>>s produced by <<key_name>>. studio_summary: <<library_typeU>>s produced by <<key_name>>.
# example key_name: English
subtitle_language_name: <<key_name>> Subtitles subtitle_language_name: <<key_name>> Subtitles
subtitle_language_summary: <<library_type>>s with <<key_name>> Subtitles. subtitle_language_summary: <<library_typeU>>s with <<key_name>> Subtitles.
subtitle_language_other_name: Other Subtitles subtitle_language_other_name: Other Subtitles
subtitle_language_other_summary: <<library_type>>s with other uncommon Subtitles. subtitle_language_other_summary: <<library_typeU>>s with other uncommon Subtitles.
# example key_name: Robin Williams
writer_name: <<key_name>> (Writer) writer_name: <<key_name>> (Writer)
writer_summary: <<library_type>>s Written by <<key_name>>. writer_summary: <<library_typeU>>s Written by <<key_name>>.
# example key_name: 2015
year_name: Best of <<key_name>> year_name: Best of <<key_name>>
year_summary: <<library_type>>s released in <<key_name>>. year_summary: <<library_typeU>>s released in <<key_name>>.
#############################################################
# Movie #
#############################################################
#############################################################
# Show #
#############################################################

@ -150,7 +150,7 @@ cd Plex-Meta-Manager
**NOTE: The rest of this walkthrough assumes you are staying in this directory in this terminal/Powershell window.** **NOTE: The rest of this walkthrough assumes you are staying in this directory in this terminal/Powershell window.**
**IMPORTANT: In the future, when you want to run PMM at teh command line, you have to be in this directory.** **IMPORTANT: In the future, when you want to run PMM at the command line, you have to be in this directory.**
When you open a command window to run PMM, the first step will always be: When you open a command window to run PMM, the first step will always be:

@ -73,6 +73,7 @@ class DataFile:
self.data_type = "" self.data_type = ""
self.templates = {} self.templates = {}
self.translations = {} self.translations = {}
self.key_names = {}
def get_file_name(self): def get_file_name(self):
data = f"{self.config.GitHub.configs_url}{self.path}.yml" if self.type == "GIT" else self.path data = f"{self.config.GitHub.configs_url}{self.path}.yml" if self.type == "GIT" else self.path
@ -134,7 +135,9 @@ class DataFile:
if "translations" not in yaml.data: if "translations" not in yaml.data:
raise Failed(f"URL Error: Top Level translations attribute not found in {content_path}") raise Failed(f"URL Error: Top Level translations attribute not found in {content_path}")
translations = {k: {"default": v} for k, v in yaml.data["translations"]} translations = {k: {"default": v} for k, v in yaml.data["translations"]}
translations["library_type"] = {"default": self.library.type.lower() if self.library else "item"}
logger.debug(f"Translations Loaded From: {dir_path}") logger.debug(f"Translations Loaded From: {dir_path}")
key_names = {}
def add_translation(yaml_path, yaml_key, data=None): def add_translation(yaml_path, yaml_key, data=None):
yaml_content = YAML(input_data=data, path=yaml_path if data is None else None, check_empty=True) yaml_content = YAML(input_data=data, path=yaml_path if data is None else None, check_empty=True)
@ -146,6 +149,11 @@ class DataFile:
logger.error(f"Config Error: {ky} must have a default value") logger.error(f"Config Error: {ky} must have a default value")
else: else:
logger.error(f"Config Error: Top Level translations attribute not found in {yaml_path}") logger.error(f"Config Error: Top Level translations attribute not found in {yaml_path}")
if "key_names" in yaml_content.data:
for kn, vn in yaml_content.data["key_names"].items():
if kn not in translations:
key_names[kn] = {}
key_names[kn][yaml_key] = vn
if file_type in ["URL", "Git", "Repo"]: if file_type in ["URL", "Git", "Repo"]:
if "languages" in yaml.data and isinstance(yaml.data["language"], list): if "languages" in yaml.data and isinstance(yaml.data["language"], list):
@ -159,7 +167,7 @@ class DataFile:
for file in os.listdir(dir_path): for file in os.listdir(dir_path):
if file.endswith(".yml") and file != "default.yml": if file.endswith(".yml") and file != "default.yml":
add_translation(os.path.abspath(f"{dir_path}/{file}"), file[:-4]) add_translation(os.path.abspath(f"{dir_path}/{file}"), file[:-4])
return translations return translations, key_names
def apply_template(self, name, mapping_name, data, template_call, extra_variables): def apply_template(self, name, mapping_name, data, template_call, extra_variables):
if not self.templates: if not self.templates:
@ -201,7 +209,8 @@ class DataFile:
name_var = f"{self.data_type.lower()}_name" name_var = f"{self.data_type.lower()}_name"
variables[name_var] = str(name) variables[name_var] = str(name)
variables["mapping_name"] = mapping_name variables["mapping_name"] = mapping_name
variables["library_type"] = self.library.type.lower() if self.library else "items" variables["library_type"] = self.library.type.lower() if self.library else "item"
variables["library_typeU"] = self.library.type if self.library else "Item"
variables["library_name"] = self.library.name if self.library else "playlist" variables["library_name"] = self.library.name if self.library else "playlist"
for temp_key, temp_value in temp_vars.items(): for temp_key, temp_value in temp_vars.items():
@ -225,6 +234,9 @@ class DataFile:
language = variables["language"] if "language" in variables else "default" language = variables["language"] if "language" in variables else "default"
for temp_key, temp_value in self.translations.items(): for temp_key, temp_value in self.translations.items():
variables[temp_key] = temp_value[language if language in temp_value else "default"] variables[temp_key] = temp_value[language if language in temp_value else "default"]
if temp_key == "library_type":
variables[f"{temp_key}U"] = temp_value[language if language in temp_value else "default"].capitalize()
for key, value in variables.copy().items(): for key, value in variables.copy().items():
variables[f"{key}_encoded"] = requests.utils.quote(str(value)) variables[f"{key}_encoded"] = requests.utils.quote(str(value))
@ -449,10 +461,13 @@ class DataFile:
if not files: if not files:
logger.error("Config Error: No Paths Found for translations") logger.error("Config Error: No Paths Found for translations")
for file_type, template_file, _, _ in files: for file_type, template_file, _, _ in files:
temp_data = self.load_file(file_type, template_file, translation=True) temp_data, key_data = self.load_file(file_type, template_file, translation=True)
for k, v in temp_data.items(): for k, v in temp_data.items():
if k not in self.translations: if k not in self.translations:
self.translations[k] = v self.translations[k] = v
for k, v in key_data.items():
if k not in self.key_names:
self.key_names[k] = v
class MetadataFile(DataFile): class MetadataFile(DataFile):
def __init__(self, config, library, file_type, path, temp_vars, asset_directory): def __init__(self, config, library, file_type, path, temp_vars, asset_directory):

Loading…
Cancel
Save