set i18n default language

224 views
Skip to first unread message

Gerhard Schmidt

unread,
Jun 9, 2021, 2:08:13 AM6/9/21
to pylons-...@googlegroups.com
Hi,

I'm developing some web applications form my company using pyramid. Most
of the time I develop them in German first and do translations later.

This causes me some unnecessary work when starting with translations,
because default language is English. So I have to change the German
texts to English and move the German to the translation files.

It would be much easier to simply define the default language as German
and add English translations. As you can guess. German is my main
language so I can outsource the translations to English someone and
concentrate on the German texts.

Is there a way to define that a pyramid project is in German when using
i18n.

Regard
Estartu


Steve Piercy

unread,
Jun 9, 2021, 3:24:58 AM6/9/21
to pylons-...@googlegroups.com
A Pyramid project has no default language, internationalization (i18n), or localization (l10n). You may add them and their translations to a project.

https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/i18n.html

Once you establish i18n and i10n in your project, you may set any supported language as the default.

--steve

Gerhard Schmidt

unread,
Jun 19, 2021, 4:20:14 AM6/19/21
to pylons-...@googlegroups.com, steve.pi...@gmail.com
Hi Steve,

I have i18n set up an working but all templates and texts in the code
are interpreted as English by default.

My problem is that I want to write texts and Templates in German and do
the English translations later.

Is there a way to say. "Hey extractor, any text you find is German not
English."

This may be only a tool problem because poedit always complain about
editing the default language when I try to do the English translations.

Does the gettext system have a default language or is the just poedit
being ignorant.

Regards
Estartu


Am 09.06.21 um 09:24 schrieb Steve Piercy:

Steve Piercy

unread,
Jun 19, 2021, 5:00:37 AM6/19/21
to pylons-...@googlegroups.com
I don't know. I don't use poedit.

Here's how we have documented how to extract the messages.

https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/i18n.html#extracting-messages-from-code-and-templates

--steve

Eldav

unread,
Jun 22, 2021, 4:49:34 AM6/22/21
to pylons-discuss

Hi Estartu,

As far as I know, extractors only extract messages to .pot files (PO Templates), as their name implies, nothing more. POT files are not associated to a language, they just list messages IDs found in the source code, with the corresponding translations left empty. So, I have doubts about your interpretation that "texts in the code are interpreted as English by default".

Suggestion: look at the headers of your POT file(s), and see if there is a language defined there (there shouldn't be). It should look like;

#
# SOME DESCRIPTIVE TITLE
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE 1.0\n"
"POT-Creation-Date: 2021-04-06 01:56+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS\n"
"Language-Team: LANGUAGE <L...@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Lingua 4.14\n"


As a second step, you merge your POT file with your existing language files (PO files, one per language, whereas there is usually only one POT file per project). The merge process basically:

- creates new entries with empty translations,
- leaves the existing entries alone (apart from updating the locations in the code where they were encountered),
- comments out entries no longer existing in the code.

At that stage, you can update the translations by hand (Emacs, PoEdit, ...) in the PO files (not the POT file, which you should never touch), and then compile them into MO files when you're done. You're not using POEdit on the POT file, right?

Hope this helps,

Laurent.
Reply all
Reply to author
Forward
0 new messages