可以通過系統(tǒng)變量LOCATE來判斷你的系統(tǒng)屬于什么語言。英文系統(tǒng)為enu。簡(jiǎn)體中文為chs,繁體中文為cht。

建議把所有的文字提示內(nèi)容寫在程序前面用變量定義(最好是用LIST列表的形式寫到一個(gè)變量中),每一種語言寫一個(gè)列表變量,語言判斷后直接取相應(yīng)語言的列表。在程序中需要顯示文字的地方則直接顯示列表中的某一位置的內(nèi)容就行。這有得于程序的簡(jiǎn)單化,修改及添加其它語言的資源也簡(jiǎn)單。

(defun C:OC (/ DI LANGLST LAY LST O PO)
  (setq LANGLST '(("ENU"
     "nCurrent offset dist= "
     "nEnter Offset Dist:"
     "nSide to offset"
    )
    ("CHT"
     "n目前偏移距離= "
     "n輸入偏移距離:"
     "n選取偏移側(cè)"
    )
   )
  )
  (setq LST (cdr (assoc (getvar "LOCALE") LANGLST)))
  (vl-cmdf "_.undo" "_group")
  (mapcar 'princ
   (list (nth 0 LST) (getvar "OFFSETDIST") " ")
  )
  (setq DI (getstring (nth 1 LST)))
  (setq O (ssget))
  (setq PO (getpoint (nth 2 LST)))
  (setq LAY (getvar "CLAYER"))
  (if (/= DI NIL)
    (command "OFFSET" DI O PO "")
    (command "CHPROP" "L" "" "LA" LAY "LT" "bylayer" "C" "bylayer" "")
  )
  (if (= DI NIL)
    (command "OFFSET" "" O PO "")
    (command "CHPROP" "L" "" "LA" LAY "LT" "bylayer" "C" "bylayer" "")
  )
  (vl-cmdf "_.undo" "_end")
  (princ)
)