Variable for user name in Studio Templates path

I am using Trados Studio 2021 SR2 - 16.2.9.9198. And before creating this post I tried several solutions and I also kept googling and reading other posts, but I don't find anything that could help me.

We are using Studio templates for our project creation and we want to use one local termbase that is used by all of our templates. There is just one little problem: The termbase is stored on OneDrive and thus, the user name varies depending on who is working with the template. Initially, I added the local term base and then I just opened the template in Visual Studio Code to adapt it like this (see the %USERNAME% variable):

<TermbaseSettings xmlns:xsi="">www.w3.org/.../XMLSchema-instance" xmlns:xsd="">www.w3.org/.../XMLSchema">
  <Path>C:\Users\%USERNAME%\OneDrive\General\Linguistic resources\Termbases\Local termbases\__ForStudio\local.sdltb</Path>
  <IsOpen>false</IsOpen>
  <Filter>0</Filter>
  <FilterHighlight>false</FilterHighlight>
  <Layout>0</Layout>
  <Local>true</Local>
  <IsCustom>false</IsCustom>

But it does not work with a variable. I tried several variables:

  • $(Username)
  • %USERNAME%
  • %A_Username%

But none worked. Do you know how to make this work? I think there needs to be a way to add a file even though it's on OneDrive and the path changes. Slight smile
Thank you very much! Slight smile



Deleted company specific information
[edited by: Mario Abbate at 10:46 AM (GMT 0) on 6 Dec 2024]
  • Hi ,

    You've attempted to use environment variables (e.g., `%USERNAME%`, `%UserProfile%`) in the template's XML to create a dynamic path, however, Trados Studio does not support environment variables within these paths. This means that any placeholders or variables you include in the XML will not be interpreted and replaced with the actual values at runtime.

    A possible solution might look like using common path across all users, potentially?

    Example:

    Decide on a fixed path that's the same on all users' machines, such as:
    ```
    C:\LinguisticResources\Termbases\local.sdltb
    ```

    Implementation:

    • Have each user create the necessary folder structure on their local machine.

    • Place a copy of the `local.sdltb` termbase in this location.

    Update the Template:

    • Modify your project template to reference the termbase at this fixed path.

    Advantages:

    • Simplifies the template as the path is consistent across all users.

    • No need for environment variables or complex configurations.

    or...

    Use a Network Share with a Consistent UNC Path

    Store the termbase on a shared network drive that all users can access, using a UNC path like:
    ```
    \\ServerName\SharedResources\Termbases\local.sdltb
    ```

    Implementation:

    • Ensure all users have read/write access to the shared network location.

    • Store the termbase file on the network share.

    Update the Template:

    • Modify the project template to reference the termbase using the UNC path.

    Advantages:

    • Centralizes the termbase, making updates and maintenance easier.

    • Ensures all users are accessing the same, up-to-date termbase.

  •   

    Moved to a more appropriate forum.

    I'll be interested if this helpful answer works for you Mario.  Essentially you are attempting to do something that is completely unsupported and never will be.  If you want to share resources you need to be looking at a solution that has been designed to work that way.  Local resources are not.

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

    emoji
  • and , thanks a lot. We will create a new drive that everybody can access to solve this issue. Thanks a lot for your input! Slight smile Have a nice day and as we are approaching Christmas: Merry Christmas and Happy New Year! Slight smile Christmas tree

    emoji