i18n
This commit is contained in:
1 parent
5dc977f9dd
commit
41987f8ea8
17 files changed
+1258
-210
No files matched your search
+99
-42
@@ -3,10 +3,11 @@
|
||||
"""
|
||||
Genere le schema explicatif des parametres de l'extension.
|
||||
|
||||
python docs/schema_parametres.py # les deux versions
|
||||
python docs/schema_parametres.py readme # docs/parametres.svg + .png (README)
|
||||
python docs/schema_parametres.py dialogue # images/parametres.png (onglet
|
||||
# « Schéma » de la boite de dialogue)
|
||||
python docs/schema_parametres.py # les deux versions
|
||||
python docs/schema_parametres.py fr # docs/parametres.svg + .png (README)
|
||||
python docs/schema_parametres.py en # docs/parameters_en.svg
|
||||
# + images/parameters_en.png (onglet
|
||||
# « Diagram » de la boite de dialogue)
|
||||
|
||||
Les formes sont calculees par box_core (memes fonctions que l'extension),
|
||||
le schema reste donc fidele au resultat reel. L'export PNG passe par
|
||||
@@ -39,25 +40,85 @@ FONT = "font-family:Arial,Helvetica,sans-serif"
|
||||
INKSCAPE = [r"C:\Program Files\Inkscape\bin\inkscape.com", "/usr/bin/inkscape",
|
||||
"/Applications/Inkscape.app/Contents/MacOS/inkscape"]
|
||||
|
||||
# L'extension n'existe qu'en francais : deux versions du meme schema.
|
||||
# La version « dialogue » est affichee reduite (900 px de large) dans la boite de
|
||||
# dialogue : textes x 1.25 pour rester lisibles.
|
||||
# Version par langue : textes, fichiers produits, largeur du PNG et agrandissement
|
||||
# des textes (la version anglaise est affichee reduite dans la boite de dialogue :
|
||||
# 900 px de large, textes x 1.25 pour rester lisibles). Inkscape ne traduit pas
|
||||
# le chemin d'une image : la boite de dialogue montre la version anglaise.
|
||||
VERSIONS = {
|
||||
"readme": {
|
||||
"fr": {
|
||||
"svg": os.path.join(HERE, "parametres.svg"),
|
||||
"png": os.path.join(HERE, "parametres.png"),
|
||||
"png_width": 1400,
|
||||
"font_scale": 1.0,
|
||||
"text": {
|
||||
"title1": "Dimensions de la boîte",
|
||||
"front": "Avant",
|
||||
"lid": "Couvercle",
|
||||
"length": "Longueur",
|
||||
"width": "Largeur",
|
||||
"height": "Hauteur",
|
||||
"note1": ["Couvercle (pointillés) : « Boîte fermée ». Décochée : 5 pièces,",
|
||||
"bord haut des côtés droit. Minimum : 5 × l'épaisseur."],
|
||||
"title2": "Épaisseur et type de dimensions",
|
||||
"bottom": "Fond",
|
||||
"exterior": "Extérieure",
|
||||
"interior": "Intérieure",
|
||||
"thickness": "Épaisseur",
|
||||
"note2": ["Extérieures : cotes hors tout. Intérieures : l'extension ajoute",
|
||||
"2 épaisseurs (1 seule en hauteur si la boîte est ouverte)."],
|
||||
"title3": "Largeur des créneaux",
|
||||
"finger": "Créneau",
|
||||
"depth": "Profondeur = épaisseur",
|
||||
"note3": ["0 = 3 × l'épaisseur. Largeur ajustée pour un nombre impair",
|
||||
"de créneaux par bord (ici {} sur l'avant)."],
|
||||
"title4": "Compensation du kerf",
|
||||
"wanted": "Créneau voulu",
|
||||
"drawn": "Dessiné : créneau + kerf",
|
||||
"legend_drawn": "trait dessiné",
|
||||
"legend_cut": "cote après découpe",
|
||||
"note4": ["Le laser enlève kerf / 2 de chaque côté du trait : le contour",
|
||||
"est élargi d'autant. Défaut 0,1 mm ; 0 = pas de compensation."],
|
||||
},
|
||||
},
|
||||
"dialogue": {
|
||||
"svg": os.path.join(HERE, "parametres_dialogue.svg"),
|
||||
"png": os.path.join(ROOT, "images", "parametres.png"),
|
||||
"en": {
|
||||
"svg": os.path.join(HERE, "parameters_en.svg"),
|
||||
"png": os.path.join(ROOT, "images", "parameters_en.png"),
|
||||
"png_width": 900,
|
||||
"font_scale": 1.25,
|
||||
"text": {
|
||||
"title1": "Box dimensions",
|
||||
"front": "Front",
|
||||
"lid": "Lid",
|
||||
"length": "Length",
|
||||
"width": "Width",
|
||||
"height": "Height",
|
||||
"note1": ["Lid (dashed): \"Closed box\". Unchecked: 5 parts, straight",
|
||||
"top edge on the sides. Minimum: 5 × the thickness."],
|
||||
"title2": "Thickness and dimension type",
|
||||
"bottom": "Bottom",
|
||||
"exterior": "Exterior",
|
||||
"interior": "Interior",
|
||||
"thickness": "Thickness",
|
||||
"note2": ["Exterior: overall sizes. Interior: the extension adds",
|
||||
"2 thicknesses (only 1 in height for an open box)."],
|
||||
"title3": "Finger width",
|
||||
"finger": "Finger",
|
||||
"depth": "Depth = thickness",
|
||||
"note3": ["0 = 3 × the thickness. The width is adjusted to get an",
|
||||
"odd number of fingers per edge ({} on the front here)."],
|
||||
"title4": "Kerf compensation",
|
||||
"wanted": "Wanted finger",
|
||||
"drawn": "Drawn: finger + kerf",
|
||||
"legend_drawn": "drawn stroke",
|
||||
"legend_cut": "size after cutting",
|
||||
"note4": ["The laser removes kerf / 2 on each side of the stroke: the",
|
||||
"outline is widened accordingly. Default 0.1 mm; 0 = none."],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
out = []
|
||||
T = {}
|
||||
FS = 1.0
|
||||
|
||||
|
||||
@@ -139,7 +200,7 @@ def place(points, x0, y0, scale):
|
||||
|
||||
def panel_1():
|
||||
"""Longueur, largeur, hauteur : boite en perspective cavaliere."""
|
||||
panel_title(30, 50, 1, "Dimensions de la boîte")
|
||||
panel_title(30, 50, 1, T["title1"])
|
||||
s = 3.2 # px par mm
|
||||
length, width, height = 100, 80, 50
|
||||
dx, dy = 0.5 * math.cos(math.radians(35)), -0.5 * math.sin(math.radians(35))
|
||||
@@ -154,24 +215,22 @@ def panel_1():
|
||||
polygon([p(0, 0, Z), p(L, 0, Z), p(L, P, Z), p(0, P, Z)], EDGE, 2, "#e9ecef",
|
||||
'stroke-dasharray="7,5"')
|
||||
polygon([p(L, 0, 0), p(L, P, 0), p(L, P, Z), p(L, 0, Z)], EDGE, 2, "#dee2e6")
|
||||
text(*p(L / 2, 0, Z / 2 - 3), "Avant", size=16, color=GHOST, anchor="middle", halo=False)
|
||||
text(*p(L / 2, P / 2, Z + 2), "Couvercle", size=16, color=GHOST, anchor="middle",
|
||||
text(*p(L / 2, 0, Z / 2 - 3), T["front"], size=16, color=GHOST, anchor="middle", halo=False)
|
||||
text(*p(L / 2, P / 2, Z + 2), T["lid"], size=16, color=GHOST, anchor="middle",
|
||||
halo=False)
|
||||
dimension(p(0, 0, 0), p(L, 0, 0), 30, "Longueur")
|
||||
dimension(p(L, 0, 0), p(L, P, 0), 34, "Largeur", label_shift=44)
|
||||
dimension(p(0, 0, 0), p(0, 0, Z), -30, "Hauteur", label_shift=48)
|
||||
note(30, 500, ["Couvercle (pointillés) : « Boîte fermée ». Décochée : 5 pièces,",
|
||||
"bord haut des côtés droit. Minimum : 5 × l'épaisseur."])
|
||||
dimension(p(0, 0, 0), p(L, 0, 0), 30, T["length"])
|
||||
dimension(p(L, 0, 0), p(L, P, 0), 34, T["width"], label_shift=44)
|
||||
dimension(p(0, 0, 0), p(0, 0, Z), -30, T["height"], label_shift=48)
|
||||
note(30, 500, T["note1"])
|
||||
|
||||
|
||||
def panel_2():
|
||||
"""Epaisseur et dimensions interieures / exterieures : coupe verticale."""
|
||||
ox = 700
|
||||
panel_title(ox + 30, 50, 2, "Épaisseur et type de dimensions")
|
||||
panel_title(ox + 30, 50, 2, T["title2"])
|
||||
s = 5.0
|
||||
t, width, height = 6, 80, 44 # epaisseur exageree pour la lisibilite
|
||||
x0, y0 = ox + 150, 150
|
||||
hatch = 'fill="url(#hachures)"'
|
||||
|
||||
def rect(x, y, w, h):
|
||||
polygon(place([(x, y), (x + w, y), (x + w, y + h), (x, y + h)], x0, y0, s),
|
||||
@@ -180,26 +239,24 @@ def panel_2():
|
||||
rect(0, 0, t, height) # cote gauche
|
||||
rect(width - t, 0, t, height) # cote droit
|
||||
rect(0, height - t, width, t) # fond
|
||||
del hatch
|
||||
text(x0 + width / 2 * s, y0 + (height - t / 2) * s + 6, "Fond", size=15,
|
||||
text(x0 + width / 2 * s, y0 + (height - t / 2) * s + 6, T["bottom"], size=15,
|
||||
color=INK, anchor="middle")
|
||||
|
||||
top = y0
|
||||
dimension((x0, top), (x0 + width * s, top), -58, "Extérieure", label_shift=18)
|
||||
dimension((x0, top), (x0 + width * s, top), -58, T["exterior"], label_shift=18)
|
||||
dimension((x0 + t * s, top + 60), (x0 + (width - t) * s, top + 60), 0,
|
||||
"Intérieure", color=DIM2)
|
||||
T["interior"], color=DIM2)
|
||||
dimension((x0 + (width - t) * s, y0 + 12 * s), (x0 + width * s, y0 + 12 * s), 0,
|
||||
"", color=DIM)
|
||||
text(x0 + width * s + 16, y0 + 12 * s + 6, "Épaisseur", size=17, color=DIM,
|
||||
text(x0 + width * s + 16, y0 + 12 * s + 6, T["thickness"], size=17, color=DIM,
|
||||
weight="bold")
|
||||
note(ox + 30, 500, ["Extérieures : cotes hors tout. Intérieures : l'extension ajoute",
|
||||
"2 épaisseurs (1 seule en hauteur si la boîte est ouverte)."])
|
||||
note(ox + 30, 500, T["note2"])
|
||||
|
||||
|
||||
def panel_3():
|
||||
"""Creneaux : bord male de l'avant et bord femelle du couvercle."""
|
||||
oy = 540
|
||||
panel_title(30, oy + 50, 3, "Largeur des créneaux")
|
||||
panel_title(30, oy + 50, 3, T["title3"])
|
||||
length, t = 100, 4
|
||||
finger = 3 * t # valeur par defaut (parametre a 0)
|
||||
s = 5.6
|
||||
@@ -221,25 +278,24 @@ def panel_3():
|
||||
lid = [(x, 2 * lid_y - y) for x, y in edge(box_core.FEMALE, lid_y, 50)]
|
||||
polygon(lid, GHOST, 1.4, "#f8f9fa")
|
||||
polygon(edge(box_core.MALE, front_y, 150), EDGE, 2, FILL)
|
||||
text(x0 + length * s + 12, lid_y - 20, "Couvercle", size=15, color=GHOST)
|
||||
text(x0 + length * s + 12, front_y + 60, "Avant", size=15, color=GHOST)
|
||||
text(x0 + length * s + 12, lid_y - 20, T["lid"], size=15, color=GHOST)
|
||||
text(x0 + length * s + 12, front_y + 60, T["front"], size=15, color=GHOST)
|
||||
|
||||
segs = box_core.edge_segments(length, t, finger, box_core.MALE)
|
||||
a, b, _ = segs[4]
|
||||
dimension((x0 + a * s, front_y), (x0 + b * s, front_y), 50, "Créneau", label_shift=20)
|
||||
dimension((x0 + a * s, front_y), (x0 + b * s, front_y), 50, T["finger"], label_shift=20)
|
||||
c, d, _ = segs[1]
|
||||
mid = x0 + (c + d) / 2 * s
|
||||
dimension((mid, front_y), (mid, front_y + t * s), 0, "", color=DIM2)
|
||||
text(mid, front_y + t * s + 28, "Profondeur = épaisseur", size=15, color=DIM2,
|
||||
text(mid, front_y + t * s + 28, T["depth"], size=15, color=DIM2,
|
||||
weight="bold", anchor="middle")
|
||||
note(30, oy + 500, ["0 = 3 × l'épaisseur. Largeur ajustée pour un nombre impair",
|
||||
"de créneaux par bord (ici {} sur l'avant).".format(len(segs))])
|
||||
note(30, oy + 500, [line.format(len(segs)) for line in T["note3"]])
|
||||
|
||||
|
||||
def panel_4():
|
||||
"""Kerf : contour dessine decale de kerf / 2 vers l'exterieur."""
|
||||
ox, oy = 700, 540
|
||||
panel_title(ox + 30, oy + 50, 4, "Compensation du kerf")
|
||||
panel_title(ox + 30, oy + 50, 4, T["title4"])
|
||||
t, finger, kerf = 4, 8, 1.2 # kerf exagere pour la lisibilite
|
||||
s = 18
|
||||
x0, y0 = ox + 150, oy + 160
|
||||
@@ -251,21 +307,20 @@ def panel_4():
|
||||
|
||||
k = kerf / 2
|
||||
dimension((x0 + 6 * s, y0 + 0), (x0 + (6 + finger) * s, y0), 0, "")
|
||||
text(x0 + (6 + finger / 2) * s, y0 + 36, "Créneau voulu", size=15, color=DIM,
|
||||
text(x0 + (6 + finger / 2) * s, y0 + 36, T["wanted"], size=15, color=DIM,
|
||||
anchor="middle", weight="bold")
|
||||
dimension((x0 + (6 - k) * s, y0 - k * s), (x0 + (6 + finger + k) * s, y0 - k * s), -40,
|
||||
"Dessiné : créneau + kerf", color=LASER, size=16)
|
||||
T["drawn"], color=LASER, size=16)
|
||||
dimension((x0 + 22 * s, y0 + 6 * s), (x0 + (22 + k) * s, y0 + 6 * s), 0, "", color=DIM2)
|
||||
text(x0 + (22 + k) * s + 14, y0 + 6 * s + 6, "kerf / 2", size=16, color=DIM2,
|
||||
weight="bold")
|
||||
|
||||
lx, ly = x0 + 10, y0 + 13 * s + 36
|
||||
polyline([(lx, ly), (lx + 40, ly)], LASER, 2.2)
|
||||
text(lx + 50, ly + 6, "trait dessiné", size=15, halo=False)
|
||||
text(lx + 50, ly + 6, T["legend_drawn"], size=15, halo=False)
|
||||
polyline([(lx + 190, ly), (lx + 230, ly)], INK, 1.6, 'stroke-dasharray="6,4"')
|
||||
text(lx + 240, ly + 6, "cote après découpe", size=15, halo=False)
|
||||
note(ox + 30, oy + 500, ["Le laser enlève kerf / 2 de chaque côté du trait : le contour",
|
||||
"est élargi d'autant. Défaut 0,1 mm ; 0 = pas de compensation."])
|
||||
text(lx + 240, ly + 6, T["legend_cut"], size=15, halo=False)
|
||||
note(ox + 30, oy + 500, T["note4"])
|
||||
|
||||
|
||||
def export_png(svg_path, png_path, width):
|
||||
@@ -285,6 +340,8 @@ def build(name):
|
||||
global FS
|
||||
version = VERSIONS[name]
|
||||
out.clear()
|
||||
T.clear()
|
||||
T.update(version["text"])
|
||||
FS = version["font_scale"]
|
||||
|
||||
out.append('<defs><pattern id="hachures" width="8" height="8" '
|
||||
|
||||
Reference in new issue
Block a user