Krzysztof Biernacki

Krzysztof Biernacki programista PHP

Temat: Symfony 1.4 - I18n (obsługa wielu języków)

Witam.
Mam taki oto schemat w pliku schema.yml:


Article:
actAs:
Timestampable: ~
I18n:
fields: [title, keywords, description, text]
columns:
id:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: true
title:
type: string(255)
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
keywords:
type: string()
fixed: false
unsigned: false
primary: false
notnull: false
autoincrement: false
description:
type: string()
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
text:
type: string()
fixed: false
unsigned: false
primary: false
notnull: true
autoincrement: false
is_active:
type: enum(5)
fixed: false
unsigned: false
values:
- 'true'
- 'false'
primary: false
default: 'false'
notnull: true
autoincrement: false
relations:
Categories:
class: Category
refClass: CategoryHasArticle
local: article_id
foreign: category_id
foreignAlias: Articles
CategoryHasArticle:
local: id
foreign: article_id
type: many


Po wykonaniu polecenia:
doctrine:insert-sql
w bazie danych tworzą mi się dwie tabele: article oraz druga z tłumaczeniami. Sęk w tym, że w tej podstawowej (article) są kolumny typu title_en, zamiast title (polska wersja językowa), a w tej z tłumaczeniami title. W jaki sposób poinformować mechanizm Symfony o tym, aby tabela z tłumaczeniami a w niej kolumny miały znacznik _en? Proszę o wyrozumiałość i pomoc.

konto usunięte

Temat: Symfony 1.4 - I18n (obsługa wielu języków)

Ja robię schemat obydwu tabel od razu, np w XMLu:

<table name="artykul" isI18N="true" i18nTable="artykul_i18n">
<column name="id" type="INTEGER" primaryKey="true" required="true" autoIncrement="true" />
<column name="kategoria_id" type="INTEGER" required="true" />
<column name="seo_id" type="INTEGER"/>
<column name="kolejnosc" type="TINYINT" default="1"/>
<column name="przyrostek_klasy_css" type="VARCHAR" size="45" />
<column name="created_at" type="TIMESTAMP" />
<column name="updated_at" type="TIMESTAMP" />
<column name="modified_by" type="INTEGER" />
<foreign-key foreignTable="sf_guard_user" onDelete="restrict" onUpdate="cascade">
<reference local="modified_by" foreign="id" />
</foreign-key>
<foreign-key foreignTable="kategoria" onDelete="restrict" onUpdate="cascade">
<reference local="kategoria_id" foreign="id" />
</foreign-key>
<foreign-key name="fk_artykul_seo" foreignTable="seo" onDelete="restrict" onUpdate="cascade">
<reference local="seo_id" foreign="id"/>
</foreign-key>
</table>

<table name="artykul_i18n">
<column name="id" type="integer" required="true" primaryKey="true" />
<column name="culture" isCulture="true" type="varchar" size="7" required="true" primaryKey="true" />
<column name="tytul" type="VARCHAR" size="255" required="true" />
<column name="slug" type="VARCHAR" size="300" />
<column name="tresc" type="CLOB" size="4294967295" />
<foreign-key foreignTable="artykul" onDelete="cascade" onUpdate="cascade">
<reference local="id" foreign="id" />
</foreign-key>
</table>



Wyślij zaproszenie do