-
Notifications
You must be signed in to change notification settings - Fork 0
/
cms_translation_notes
56 lines (44 loc) · 1.8 KB
/
cms_translation_notes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
IDEA:
opyright 2014, Martin Owens <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
We want to log the changes to translations. For credit and tracking.
"""
Takes pages of content:
1. Create TranslatedContentPlugin
a. Takes the english version of the site
b. Generates a list of translatable messages
c. Translates them with cache into a page for this language
2. Lists all pages
a. Fill in all empty page*language slots with TranslatedContentPlugin
b. Generate a list of translatable messages (see 1b)
c. Generate whole pot file for translation
d. Generate mo file (rosetta should handle this)
e. Make sure this is available for translations
f. Translate titles, menus of all pages, regardless.
from cms.models import Page
page = Page.objects.all()[...]
draft_page = page.get_draft_object()
published_page = page.get_public_object()
list[str] = page.get_languages()
str = page.get_page_title(lang)
str = page.get_title(lang)
str = page.get_menu_title(lang)
str = page.get_meta_description(lang)
bool = page.is_published(lang)
d = [ d.get_plugin_instance()[0] for c in b.placeholders.all() for d in c.get_plugins('en') ]
p = d[0].get_plugin_class_instance()
(i, p) = d[0].get_plugin_instance()