Comments (15)
The question is: do we want to automatically copy it for all idioms? Or just for english? And which one is a better default even for other languages, showing no text or showing the text in english?
It feels copying msgstr for the merge is indeed the best way to go.
from gettext.
I was thinking only for English, otherwise you'll have stray english fragments to track down when you make changes
from gettext.
@chrismccord right. assuming you don't track those down, the website/app will show no text, which I think is worse even for non-english languages?
from gettext.
The idea would be to turn a .pot
(with blank strings) into a .po
only when you're ready to translate all of the strings in the language of the new .po
.
@josevalim / @chrismccord Do you think people would use ""
as a translation on purpose for some reason? If not, we could just make gettext see ""
as untranslated strings, so that when it encounters one, it just returns the msgid
. (I think I already proposed this a long time ago but we didn't think about it too much because it was a bit early in the life of gettext)
from gettext.
I like what @whatyouhide is proposing. It prevents the case of showing no text where no translation is yet provided, making it easy for a programmer to internationalize up front and defer localization. It also yields a translation file that a translator can more easily and intuitively complete (i.e., they don’t have to delete text or hunt for where they left off). It also facilitates piecemeal translation: it’s clear where translations are missing in the .po
, those strings are empty.
from gettext.
Also, the tools for working with .po
files expect that a blank msgstr
is awaiting translation (not one whose text matches its msgid
). The portable object format and its generation is pretty clearly defined. The parsing of those files is not. That’s where we can define new behaviour, such as translating msgstr ""
to its msgid
.
from gettext.
@endersstocker the parsing may not be clearly defined, but I wouldn't do things like msgstr :empty
or turning msgstr ""
into msgstr MSGID_HERE
in the parser (a lot of tools support reading/writing PO files and I want to mess them up as little as possible).
What I was proposing was doing this at a higher level, in the l(n)gettext
functions: when we try to find a translation for "foo"
in locale "loc"
but get back ""
, then we fallback to the value of the msgid
.
from gettext.
@whatyouhide I’m with you. I meant parsing in a broader sense. I’m saying keep the .po
generation the way it is; change how gettext handles an entry with msgstr ""
.
from gettext.
@whatyouhide just so I understand, do tools like poedit use things like msgstr ""
to identify what needs to be translated? Couldn't use a comment for that (like we do with # fuzzy
?
At first, replacing ""
makes me feel a bit uncomfortable. But if we don't have another option, then we don't have another option. :)
from gettext.
@josevalim I'm not sure but when you take a .pot
file and create a new .po
file from that file using poedit, msgstrs are empty (""
), so I guess this is the correct behaviour? I can't find a "filter" option in poedit to show what needs to be translated but when you make poedit check for problems with translations, it reports this:
The translations that it reports as "not translated yet" are just translations with empty msgstr
.
from gettext.
@whatyouhide so we should do it on our gettext side, you are right. If we have an empty string, we should show msgid.
from gettext.
@josevalim yep. Should we warn somewhere for this kind of things? Something akin to ".po file for locale pt_BR exists but this translation is empty"
?
from gettext.
If we are going to warn, then we need a way to copy the msgid to msgstr, at least for english based locales. Otherwise, I would go with no warning.
from gettext.
Ok, #56 got merged so now the behaviour for translations with empty msgstr
is to just default to the msgsid
. (for plural translation, "empty msgstr" means one or more empty msgstrs)
from gettext.
😻
from gettext.
Related Issues (20)
- check-up-to-date fails even though files are just extracted HOT 8
- Flaky test in `gettext.extract`
- Duplicate Filename in Reference when `:write_reference_line_numbers` is set to `false`
- Gettext.PluralFormError for plural form "1" in "ja" locale HOT 9
- `gettext.merge` FunctionClauseError HOT 4
- Module is not loaded because :nofile HOT 4
- Mention file path in plural forms deprecation warning HOT 4
- Plural Forms warning occurs in newly generated language file HOT 2
- bump a new version for #359 HOT 1
- Duplicate msgid with singular and plural form HOT 5
- Running `mix gettext.extract` doesn't extract new messages with Elixir 1.15 HOT 2
- Retain custom flags during merge HOT 3
- Interpolation option set but not working HOT 4
- Duplicate references in POT files and warnings about redefining modules HOT 5
- compile depend excoveralls - origin/httpc failed HOT 1
- Add `Gettext.example` macro HOT 6
- If changes to `.po` file are discarded (accidentally), they're not added back HOT 17
- Allow to transform messages at compile time HOT 3
- `expo.msguniq` merges translations with different plurals HOT 4
- Locale changes between static mount and liveview HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gettext.