Skip to content

Commit

Permalink
fix: 在 git 檔案內將 { 提取 => 獲取 }
Browse files Browse the repository at this point in the history
  • Loading branch information
bluelovers committed Jan 25, 2022
1 parent 3c9806f commit 9dc1d8a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
26 changes: 26 additions & 0 deletions lib/handleText.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { processIdeaSegmentText } from './segment';
import { updateMeta } from './meta';

export function handleText(content_old: string, info?: {
file?: string,
})
{
const file = info?.file ?? '';

return processIdeaSegmentText(content_old)
.then(content_new =>
{
if (/META-INF\/plugin\.xml$/i.test(file))
{
content_new = updateMeta(content_new);
}
else if (/GitBundle.properties$/i.test(file))
{
content_new
.replace(/提取/g, '獲取')
;
}

return content_new
})
}
8 changes: 2 additions & 6 deletions scripts/to-zht.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { gray, red } from 'ansi-colors';
import { updateMeta } from '../lib/meta';
import { processIdeaSegmentText } from '../lib/segment';
import { array_unique_overwrite } from 'array-hyper-unique';
import { handleText } from '../lib/handleText';

const multibar = createMultiBar();

Expand Down Expand Up @@ -62,12 +63,7 @@ export default FastGlob<string>([
{
const content_old = await readFile(fullpath).then(content => content.toString());

let content_new = await processIdeaSegmentText(content_old);

if (/META-INF\/plugin\.xml$/i.test(file))
{
content_new = updateMeta(content_new);
}
let content_new = await handleText(content_old);

if (content_new !== content_old)
{
Expand Down

0 comments on commit 9dc1d8a

Please sign in to comment.