Storing and Displaying Translated Tags If you wish to store two versions of some tags (original + translated), the method proposed here uses:
- one custom tag to store all the translations,
- virtual tags, one for each translated piece of information.
|
Example used throughout this postLet us take as example a track and its translation/transliteration:
| Original | Translated/Transliterated |
Album Artist | ЧАЙКОВСКИЙ, Пётр | TCHAIKOVSKY, Piotr |
Album | Complete Piano Works (vol. 4) | |
Artist | ПОСТНИКОВА, Виктория | POSTNIKOVA, Viktoria |
Composer | ЧАЙКОВСКИЙ, Пётр | TCHAIKOVSKY, Piotr |
Work | Времена года | The Seasons |
Movement Name | Декабрь: Святки | December: Christmas |
Title | Времена года - 12. Декабрь: Святки | The Seasons - 12. December: Christmas |
Custom tagOne custom tag suffices to store all the translations if you follow simple syntactic conventions.
Custom tag:
TranslatedTagsConventions:
- Each piece of information is in the form {TagName: Value} or {TagCode: Value}.
- Semicolons ; are optional, but allow for a clearer display with the tag inspector.
With our example,
TranslatedTags will contain:
{Album Artist:TCHAIKOVSKY, Piotr}; {Artist:POSTNIKOVA, Viktoria}; {Composer:TCHAIKOVSKY, Piotr}; {Work:The Seasons}; {Movement Name:December: Christmas}; {Title:The Seasons - 12. December: Christmas}
NOTES:- If you already use { and } in your tags, choose other unique symbols.
- While complete tag names are used here, two-letter codes could also do the trick: AA, AR, CO, WO, MO, TI.
Typical virtual tag formulaVirtual tag
TranslatedArtist will display:
- the piece of information found in
TranslatedTags within
{Artist:} or
{AR:} if it exists,
-
Artist otherwise (inside an $IsNull declaration to prevent from displaying "Unknown Artist").
The matching formula is the following:
$If(
$IsMatch(<TranslatedTags>,"(?<={(Artist|AR)[:])[^}]*(?=})"),
$RxMatch(<TranslatedTags>,"(?<={(Artist|AR)[:])[^}]*(?=})"),
$IsNull(<Artist>,,<Artist>)
)
(Newlines and indentations have been added for the sake of readability.)Comments:
- [^}]* = a string containing no '}', possibly null
- (?<={(Artist|AR)[:]) = the string must be preceded by '{Artist:' or '{AR:'
- (?=}) = the string must be followed by '}'
Formulas for common tagsJust adapt the table to your needs:
- if you wish to use other separators;
- if you use other fields, such as
Conductor,
Lyricist, etc.
Virtual Tag | Formula | Result |
TranslatedAlbumArtist | $If($IsMatch(<TranslatedTags>,"(?<={(Album Artist|AA)[:])[^}]*(?=})"),$RxMatch(<TranslatedTags>,"(?<={(Album Artist|AA)[:])[^}]*(?=})"),$IsNull(<Album Artist>,,<Album Artist>)) | TCHAIKOVSKY, Piotr |
TranslatedAlbum | $If($IsMatch(<TranslatedTags>,"(?<={(Album|AL)[:])[^}]*(?=})"),$RxMatch(<TranslatedTags>,"(?<={(Album|AL)[:])[^}]*(?=})"),$IsNull(<Album>,,<Album>)) | |
TranslatedArtist | $If($IsMatch(<TranslatedTags>,"(?<={(Artist|AR)[:])[^}]*(?=})"),$RxMatch(<TranslatedTags>,"(?<={(Artist|AR)[:])[^}]*(?=})"),$IsNull(<Artist>,,<Artist>)) | POSTNIKOVA, Viktoria |
TranslatedComposer | $If($IsMatch(<TranslatedTags>,"(?<={(Composer|CO)[:])[^}]*(?=})"),$RxMatch(<TranslatedTags>,"(?<={(Composer|CO)[:])[^}]*(?=})"),$IsNull(<Composer>,,<Composer>)) | TCHAIKOVSKY, Piotr |
TranslatedWork | $If($IsMatch(<TranslatedTags>,"(?<={(Work|WO)[:])[^}]*(?=})"),$RxMatch(<TranslatedTags>,"(?<={(Work|WO)[:])[^}]*(?=})"),$IsNull(<Work>,,<Work>)) | The Seasons |
TranslatedMovementName | $If($IsMatch(<TranslatedTags>,"(?<={(Movement Name|MO)[:])[^}]*(?=})"),$RxMatch(<TranslatedTags>,"(?<={(Movement Name|MO)[:])[^}]*(?=})"),$IsNull(<Movement Name>,,<Movement Name>)) | December: Christmas |
TranslatedTitle | $If($IsMatch(<TranslatedTags>,"(?<={(Title|TI)[:])[^}]*(?=})"),$RxMatch(<TranslatedTags>,"(?<={(Title|TI)[:])[^}]*(?=})"),$IsNull(<Title>,,<Title>)) | The Seasons - 12. December: Christmas |
ReferencesMusicBee functions for virtual tags cheatsheetRegular Expressions: coding, examples, testing resources