Translation / Localization
There are two methods of adding translations. The first method is preferred and will be easier for players who will not have to download multiple mods to get translations. The second method will be more useful if the maintainer of this mod is unresponsive - you can add translations without their help.
- Add to this mod
Please take a look at r6\scripts\Improved NCPD Map Filters\LocalizationPackages\English.reds. If you provide me with the equivalent to those 3 English lines in your already localized language, it's easy to add them directly to the mod.
- Publish your own translation mod that depends on this mod
Create your own mod that contains a single file that looks like the below. I'll use the existing Simplified Chinese translation provided by Banyuan7858 as an example, even though this has already been added to this mod using method 1.
Your mod can contain a single file in r6\scripts, let's say it's called ImprovedNCPDMapFilters_SimplifiedChinese.reds. It's contents can look like so:
module V1ld.ImprovedNCPDMapFilters.Translation.SimplifiedChinese // (1) Change SimplifiedChinese to your language or some unique string
import Codeware.Localization.*
public class LocalizationProvider extends ModLocalizationProvider
public func GetPackage(language: CName) -> ref<ModLocalizationPackage> {
return Equals(language, n"zh-cn") ? new LocalizationPackage() : null; // (2) Replace "zh-cn" with the locale name for your language
}
}
public class LocalizationPackage extends ModLocalizationPackage {
protected func DefineTexts() -> Void {
// Simplified Chinese translation from Banyuan7858 (https://www.nexusmods.com/users/118473658)
this.Text("ImprovedNCPDMapFilters-UI-Menus-WorldMap-Filter-NcpdScanner-Assaults", "NCPD: 袭击犯罪"); // (3)
this.Text("ImprovedNCPDMapFilters-UI-Menus-WorldMap-Filter-NcpdScanner-Suspected", "NCPD: 涉嫌有组织犯罪活动"); // (3)
this.Text("ImprovedNCPDMapFilters-UI-Menus-WorldMap-Filter-NcpdScanner-Reported", "NCPD: 举报犯罪"); // (3)
}
}
Pay attention to the lines marked with (1), (2) & (3) above and follow the instructions for (1) and (2). For (3), you'll need to replace the 3 lines with your translations. The English versions of those 3 lines look like this. Change only the parts within "NCPD: ..." and nothing else on that line!
public class LocalizationPackage extends ModLocalizationPackage {
protected func DefineTexts() -> Void {
this.Text("ImprovedNCPDMapFilters-UI-Menus-WorldMap-Filter-NcpdScanner-Assaults", "NCPD: Assault");
this.Text("ImprovedNCPDMapFilters-UI-Menus-WorldMap-Filter-NcpdScanner-Suspected", "NCPD: Suspected Crime");
this.Text("ImprovedNCPDMapFilters-UI-Menus-WorldMap-Filter-NcpdScanner-Reported", "NCPD: Reported Crime");
}
}
When you publish your mod, be sure to state that this mod is a requirement. Players will need both this mod and the translation for it to work.
Which of the 2 methods you choose is up to you. The advantage of method 2 is that it will continue to work even if the author of this mod is unresponsive.