mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2024-12-13 05:35:39 +02:00
1.6 KiB
1.6 KiB
NStr string literal format
Noncompliant Code Example
Should pass only single string literal in first paramenter of the NStr function.
Procedure NonCompliant1(Message) Export
Message = NStr("en = 'User message'" + Chars.LF);
EndProcedure
The string literal in first parameter should not be empty.
Procedure NonCompliant2(Message) Export
Message = NStr("");
EndProcedure
The format of string literal should be valid: "key1 = 'value 1'; key2 = 'value 2';"
.
Procedure NonCompliant3(Message) Export
Message = NStr("en = User message");
EndProcedure
The language code should be existing language code in configuration languages.
Procedure NonCompliant4(Message) Export
Message = NStr("en2 = 'User message'");
EndProcedure
The message for language code should not be empty.
Procedure NonCompliant5(Message) Export
Message = NStr("en = ''");
EndProcedure
The message for language code should not ends with space.
Procedure NonCompliant6(Message) Export
Message = NStr("en = 'User message '");
EndProcedure
The message for language code should not ends with new line.
Procedure NonCompliant7(Message) Export
Message = NStr("en = 'User message
|'");
EndProcedure
Compliant Solution
Procedure Compliant(Message) Export
Message = NStr("en = 'User message'");
EndProcedure