From 61c3ef648fc5ea26d38223f4222175c7817ff0c1 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Sat, 1 Oct 2022 20:14:55 -0400 Subject: [PATCH] [66] update translation --- VERSION | 2 +- defaults/translations/CHANGELOG | 37 +++++++++++ defaults/translations/default.yml | 105 +++++++++++++++++++----------- docs/home/guides/local.md | 2 +- modules/meta.py | 21 +++++- 5 files changed, 124 insertions(+), 43 deletions(-) create mode 100644 defaults/translations/CHANGELOG diff --git a/VERSION b/VERSION index 9a86e881..f1cb31fb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.3-develop65 +1.17.3-develop66 diff --git a/defaults/translations/CHANGELOG b/defaults/translations/CHANGELOG new file mode 100644 index 00000000..4048239b --- /dev/null +++ b/defaults/translations/CHANGELOG @@ -0,0 +1,37 @@ + +1.18.0 -> 1.18.0.1 + +added library_type +added key_names +added comments + +imdb_popular_summary: Changed `<>` to `IMDb Popular` +imdb_top_summary: Changed `<>` to `IMDb Top 250` +imdb_lowest_summary: Changed `<>` to `IMDb Lowest Rated` + +actor_summary: Changed `<>` to `<>` +audio_language_summary: Changed `<>` to `<>` +audio_language_other_summary: Changed `<>` to `<>` +content_rating_name: Changed `<>` to `<>` +content_rating_summary: Changed `<>` to `<>` +content_rating_other_summary: Changed `<>` to `<>` +country_name: Changed `<>` to `<>` +country_summary: Changed `<>` to `<>` +country_other_summary: Changed `<>` to `<>` +director_summary: Changed `<>` to `<>` +genre_name: Changed `<>` to `<>` +genre_summary: Changed `<>` to `<>` +producer_summary: Changed `<>` to `<>` +resolution_name: Changed `<>` to `<>` +resolution_summary: Changed `<>` to `<>` +resolution_standards_name: Changed `<>` to `<>` +resolution_standards_summary: Changed `<>` to `<>` +resolution_standards_other_summary: Changed `<>` to `<>` +seasonal_name: Changed `<>` to `<>` +streaming_name: Changed `<>` to `<>` +streaming_summary: Changed `<>` to `<>` +studio_summary: Changed `<>` to `<>` +subtitle_language_summary: Changed `<>` to `<>` +subtitle_language_other_summary: Changed `<>` to `<>` +writer_summary: Changed `<>` to `<>` +year_summary: Changed `<>` to `<>` \ No newline at end of file diff --git a/defaults/translations/default.yml b/defaults/translations/default.yml index 39ffd4d5..1480f7b0 100644 --- a/defaults/translations/default.yml +++ b/defaults/translations/default.yml @@ -1,4 +1,17 @@ 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: ############################################################# # Award # @@ -7,24 +20,28 @@ translations: bafta_best_name: BAFTA Best Films bafta_best_summary: British Academy of Film and Television Arts Best Film Winners. + # example key_name: 2022 bafta_year_name: BAFTA <> bafta_year_summary: <> BAFTA Awards. cannes_best_name: Cannes Golden Palm Winners cannes_best_summary: Cannes Golden Palm Winners. + # example key_name: 2022 cannes_year_name: Cannes <> cannes_year_summary: <> Cannes Awards. choice_year_name: Critics Choice Awards <> choice_year_summary: <> Critics Choice Awards. + # example key_name: 2022 emmy_year_name: Emmys <> emmy_year_summary: <> Emmy Winners. golden_best_name: Golden Globe Best Motion Pictures golden_best_summary: Golden Globe Best Motion Pictures. + # example key_name: 2022 golden_year_name: Golden Globe <> golden_year_summary: <> Golden Globe Winners. @@ -34,6 +51,7 @@ translations: 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. + # example key_name: 2022 oscars_year_name: Oscars Winners <> oscars_year_summary: Academy Awards (Oscars) Winners for <>. @@ -49,12 +67,14 @@ translations: 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. + # example key_name: 2022 spirit_year_name: Independent Spirit Awards <> spirit_year_summary: <> Independent Spirit Awards. 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. + # example key_name: 2022 sundance_year_name: Sundance Film Festival <> sundance_year_summary: Sundance Film Festival of <>. @@ -80,17 +100,18 @@ translations: basic_episodes_name: New Episodes basic_episodes_summary: A collection of newly-released <>s. + # possible key_name: Netflix, Disney, HBO, Hulu, Paramount Plus, Prime Video flixpatrol_name: <> Top <> flixpatrol_summary: Top <> <>s on <> according to FlixPatrol. imdb_popular_name: IMDb Popular - imdb_popular_summary: List of <> <>s. + imdb_popular_summary: List of IMDb Popular <>s. imdb_top_name: IMDb Top 250 - imdb_top_summary: List of <> <>s. + imdb_top_summary: List of IMDb Top 250 <>s. imdb_lowest_name: IMDb Lowest Rated - imdb_lowest_summary: List of <> <>s. + imdb_lowest_summary: List of IMDb Lowest Rated <>s. mal_popular_name: MyAnimeList Popular mal_popular_summary: A collection of the most popular Anime according to MyAnimeList. @@ -159,77 +180,85 @@ translations: # Both # ############################################################# + # example key_name: Robin Williams actor_name: <> - actor_summary: <>s with <>. + actor_summary: <>s with <>. + # example key_name: English audio_language_name: <> Audio - audio_language_summary: <>s filmed in the <> Language. + audio_language_summary: <>s filmed in the <> Language. audio_language_other_name: Other Audio - audio_language_other_summary: <>s filmed in other uncommon Languages. + audio_language_other_summary: <>s filmed in other uncommon Languages. - content_rating_name: <> <>s - content_rating_summary: <>s that are rated <>. + # example key_name: TV-MA + content_rating_name: <> <>s + content_rating_summary: <>s that are rated <>. content_rating_other_name: Other Ratings - content_rating_other_summary: <>s with other uncommon Ratings. + content_rating_other_summary: <>s with other uncommon Ratings. - country_name: <> <>s - country_summary: <>s filmed in <>. + # example key_name: United States + country_name: <> <>s + country_summary: <>s filmed in <>. country_other_name: Other Countries - country_other_summary: <>s filmed in other uncommon Countries. + country_other_summary: <>s filmed in other uncommon Countries. + # example key_name: 2010s decade_name: Best of <> decade_summary: Top <> <>s of the <>. + # example key_name: 2010 decade_show_name: Best of <>s decade_show_summary: Top <> <>s of the <>s. + # example key_name: Robin Williams director_name: <> (Director) - director_summary: <>s Directed by <>. + director_summary: <>s Directed by <>. - genre_name: <> <>s - genre_summary: <>s that have the genre <>. + # example key_name: Action + genre_name: <> <>s + genre_summary: <>s that have the genre <>. + # example key_name: Robin Williams producer_name: <> (Producer) - producer_summary: <>s Produced by <>. + producer_summary: <>s Produced by <>. - resolution_name: <> <>s - resolution_summary: <>s that have the resolution <>. + # example key_name: 1080p + resolution_name: <> <>s + resolution_summary: <>s that have the resolution <>. - resolution_standards_name: <> <>s - resolution_standards_summary: <>s that have the resolution <>. + # example key_name: 1080p + resolution_standards_name: <> <>s + resolution_standards_summary: <>s that have the resolution <>. resolution_standards_other_name: Other Resolutions - resolution_standards_other_summary: <>s that have other uncommon resolutions. + resolution_standards_other_summary: <>s that have other uncommon resolutions. - seasonal_name: <> <>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: <> <>s seasonal_summary: A collection of <> <>s that may relate to the season. - streaming_name: <> <>s - streaming_summary: <>s streaming on <>. + # possible key_names: All 4, Apple TV+, BET+, BritBox, Disney+, hayu, HBO Max, Hulu, Netflix, NOW, Paramount+, Peacock, Prime Video + streaming_name: <> <>s + streaming_summary: <>s streaming on <>. + # example key_name: Studio Ghibli studio_name: <> - studio_summary: <>s produced by <>. + studio_summary: <>s produced by <>. + # example key_name: English subtitle_language_name: <> Subtitles - subtitle_language_summary: <>s with <> Subtitles. + subtitle_language_summary: <>s with <> Subtitles. subtitle_language_other_name: Other Subtitles - subtitle_language_other_summary: <>s with other uncommon Subtitles. + subtitle_language_other_summary: <>s with other uncommon Subtitles. + # example key_name: Robin Williams writer_name: <> (Writer) - writer_summary: <>s Written by <>. + writer_summary: <>s Written by <>. + # example key_name: 2015 year_name: Best of <> - year_summary: <>s released in <>. - - ############################################################# - # Movie # - ############################################################# - - - ############################################################# - # Show # - ############################################################# + year_summary: <>s released in <>. diff --git a/docs/home/guides/local.md b/docs/home/guides/local.md index 279b79eb..ef116f1e 100644 --- a/docs/home/guides/local.md +++ b/docs/home/guides/local.md @@ -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.** -**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: diff --git a/modules/meta.py b/modules/meta.py index 4dc8cf1f..c2d90f04 100644 --- a/modules/meta.py +++ b/modules/meta.py @@ -73,6 +73,7 @@ class DataFile: self.data_type = "" self.templates = {} self.translations = {} + self.key_names = {} def get_file_name(self): 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: 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["library_type"] = {"default": self.library.type.lower() if self.library else "item"} logger.debug(f"Translations Loaded From: {dir_path}") + key_names = {} 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) @@ -146,6 +149,11 @@ class DataFile: logger.error(f"Config Error: {ky} must have a default value") else: 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 "languages" in yaml.data and isinstance(yaml.data["language"], list): @@ -159,7 +167,7 @@ class DataFile: for file in os.listdir(dir_path): if file.endswith(".yml") and file != "default.yml": 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): if not self.templates: @@ -201,7 +209,8 @@ class DataFile: name_var = f"{self.data_type.lower()}_name" variables[name_var] = str(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" for temp_key, temp_value in temp_vars.items(): @@ -225,6 +234,9 @@ class DataFile: language = variables["language"] if "language" in variables else "default" for temp_key, temp_value in self.translations.items(): 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(): variables[f"{key}_encoded"] = requests.utils.quote(str(value)) @@ -449,10 +461,13 @@ class DataFile: if not files: logger.error("Config Error: No Paths Found for translations") 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(): if k not in self.translations: 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): def __init__(self, config, library, file_type, path, temp_vars, asset_directory):