Skip to content

Commit 0aae23d

Browse files
committed
Emit previous translation of an obsolete entry
1 parent 7c76c65 commit 0aae23d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lib/pocompiler.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ function Compiler (table = {}, options = {}) {
7070
* in the form of {translator:'', reference: '', extracted: '', flag: '', previous:''}
7171
*
7272
* @param {Object} comments A comments object
73+
* @param {boolean} [obsolete] This comments object is for an obsolete block
7374
* @return {String} A comment string for the PO file
7475
*/
75-
Compiler.prototype._drawComments = function (comments) {
76+
Compiler.prototype._drawComments = function (comments, obsolete = false) {
7677
const lines = [];
7778
const types = [{
7879
key: 'translator',
@@ -88,7 +89,7 @@ Compiler.prototype._drawComments = function (comments) {
8889
prefix: '#, '
8990
}, {
9091
key: 'previous',
91-
prefix: '#| '
92+
prefix: obsolete ? '#~| ' : '#| '
9293
}];
9394

9495
types.forEach(type => {
@@ -121,7 +122,7 @@ Compiler.prototype._drawBlock = function (block, override = {}, obsolete = false
121122
let comments = override.comments || block.comments;
122123

123124
// add comments
124-
if (comments && (comments = this._drawComments(comments))) {
125+
if (comments && (comments = this._drawComments(comments, obsolete))) {
125126
response.push(comments);
126127
}
127128

0 commit comments

Comments
 (0)