Like a variant, a namespace is an additional metadata or unique identifier for a file (or URL) of content in Smartling. When uploading files manually, Smartling automatically uses the file name as a namespace. This cannot be modified. However, if you upload files to Smartling via an API integration, you have control over the namespace and can specify it for each file you push to Smartling. The namespace is set to null by default in the case of GDN content.
Namespaces are used for string deduplication. How you choose to control the namespace, impacts string uniqueness in Smartling. If you have strings with the same text, and/or same variant coming from files with different namespaces, they are considered unique strings in Smartling.
Example
Take the following two Java Properties files, for example:
Key1 = A string to translate
sample1.properties
Key1 = A string to translate
sample2.properties
If sample1.properties and sample2.properties are uploaded to Smartling, the parser produces these strings for deduplication:
Text |
Variant |
Namespace |
A string to translate |
Key1 |
sample1.properties |
A string to translate |
Key1 |
sample2.properties |
Although the text and variants are the same, the namespace is different, and so the strings are considered different and are not deduplicated, i.e., two strings are presented for translation.
While the default behavior of automatically using the file URI as the namespace is usually desirable, it can be overridden by specifying a namespace via API when uploading the file.
Control Namespace with String Sharing
It is possible to configure Smartling to always set the namespace to null for all strings in a project. This is referred to as ‘string sharing’ and results in all strings with the same text and variant being deduplicated in a project, regardless of what files the strings came from.
For GDN projects, the namespace is set to null by default for all strings, but this behavior can be modified. For Strings API, the namespace is set via the API.
Some Smartling Connector Configurations provide options for overriding the default namespace behavior.
Applying variants to identical strings will create unique strings, even if string sharing is enabled.
Ask your Smartling CSM if you want to enable namespace behavior for an existing account.
When Should You Control Namespaces?
An example use case for specifying custom namespaces is when multiple developers need to translate the same resources file in different code branches. In order for each developer to have their own version of the file translated, they upload it separately using the full path to the file as the URI in Smartling, including the branch.
This prevents overwriting of files uploaded by developers working in other branches, which could cause strings to disappear from the translation workflow. But to avoid unnecessary string duplication across all the copies of this file uploaded from different branches, the namespace can be set to the file path excluding the branch. This results in the deduplication of all strings that have the same key and text values across all copies of the file in Smartling.
Read Recommendation for Controlling Repetitions for more information.