Mostly switch to use of CodeWriter.
Remove many old helper functions and move
main to top.
Change-Id: I957408391c26d49e1db13265dc8ebb7829e267eb
Reviewed-on: https://go-review.googlesource.com/95823
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
More cleanup to come in separate CL.
Compact index generation currently disabled.
Will need to be enabled again as part of the
new compact index implementation.
Change-Id: I571c34b700ca3f22959ab261525827c7edfab511
Reviewed-on: https://go-review.googlesource.com/95822
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This is like the old code but different. Prevents
some internals from having to be exposed.
Change-Id: Ibfd0c98e7ed276faab20789fd753f8ef5cf6bda5
Reviewed-on: https://go-review.googlesource.com/95820
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
and make the minimal rewrite to make it build and pass tests
Removed higher-level functionality:
- canonicalization
- matching
- accept language
- coverage
- compact index
- compose
- higher level tag types
Added SuppressScript primitive to compensate for
Script removal.
Change-Id: I0e480ac6dcf78a2ab5d5a00aa0b480c8f1aed233
Reviewed-on: https://go-review.googlesource.com/95817
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This is the first CL in a sequence to enhance both the
performance and functionality of language Tags.
First step is to have CompactIndex implement the
semantics that it should have: rather than returning
Und when there is no match, it should return the closest
matching compact index. CompactIndex is often used
this way, and when it is not it was typcially a bug. This
fixes that.
Next steps are to have the fast-path internal encoding
of tag be a compact index.
The step after that is to keep two compact indexes,
allow representing both the language and locale part
of a tag like:
en-US-va-posix
and
en-GB-rg-gbsct
The result will allow for dual-mode tags resulting from
matching, simplifying the life of an API user.
(In Java the API users will get two tags from a match
and will have to decide on a case-by-case basis which
tag to use for which purpose.)
This design also allows for fast converstion to compact
indices, making it unnecessary for message.Printers to
extract this index.
Change-Id: I019ac6df4a3e3c7e6c758173fc942667df65ff36
Reviewed-on: https://go-review.googlesource.com/95815
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This is the recommended approach and will
likely replace export and generate.
Change-Id: Ie7dc0523c580715b8576de074f312b490a8727b6
Reviewed-on: https://go-review.googlesource.com/83776
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
it is added back when rendering, but makes it hard
for the translator to forget about it.
Change-Id: Ic775e0707a9ec4fc0cdcf5351933ae9b05872d81
Reviewed-on: https://go-review.googlesource.com/83816
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
- cmd/gotext generate now extracts, so no need to
create intermediate extraction file.
(next step is to just have an update command)
- shared config creation code in cmd/text
- added tests in pipeline package
Change-Id: Ifdb69710554712a79bda79502e5e03a3f3a2c9d3
Reviewed-on: https://go-review.googlesource.com/83657
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
NOTE: tests will be added soon, but in different CL
Change-Id: I4873c549938eaa2cd22ff2d725bb52bd26b26960
Reviewed-on: https://go-review.googlesource.com/83656
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
- prepares to move more code out of gotext
- accumulating results of operations in State
make it easier to add generic pipeline actions
and reuse state between operations
Change-Id: I8a109075348c03bfd05359635a20e668fcaf09e0
Reviewed-on: https://go-review.googlesource.com/83655
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Different Go compilers support different versions of Unicode.
In general, one should match the version of x/text to match
the Unicode version of the Go core. This is quite painful and
restrictive in practice.
x/text now supports multiple versions of Unicode concurrently
which are selected based on the Go compiler used (from 1.7).
Change-Id: I9a999bf603872a88932740ca7eb518c247519e06
Reviewed-on: https://go-review.googlesource.com/83235
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
and changed cmd/gotext to use it.
Change-Id: I418957cfcbcad3acb2ebcd2f65c88a43e5e7f254
Reviewed-on: https://go-review.googlesource.com/82236
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Most of the code will be turned into a package.
Change-Id: I47609e5afb176e42d3b0b29bfa04cca23ab6867f
Reviewed-on: https://go-review.googlesource.com/82235
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
The id of the translation and the key that is used at
runtime to look up the translation are not the same.
The id is used for tracking and linking messages.
The key is used for lookup internally.
Change-Id: I26cac35fb421ee8227fd8b0b5a712a752c4f5f5e
Reviewed-on: https://go-review.googlesource.com/82202
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This makes it easier to start typing.
Change-Id: I890c7533e021ab99cec2a0b51de4f743007e33e3
Reviewed-on: https://go-review.googlesource.com/82201
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Naming is now more conventional (see e.g. Gobuffalo).
- create example translation files for multiple languages
- default/extraction language is included in supported list
- example uses message.MatchLanguage
- standardized generation header
- File -> Locale; now used for all files
Change-Id: Icfb682705e103a9382a70be8aaec849fc3d8b726
Reviewed-on: https://go-review.googlesource.com/82195
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This makes plural messages work out of the box for
generated catalogs.
Change-Id: Ifc7e457d7bf909dcf067f749366e8a49ac31f6b6
Reviewed-on: https://go-review.googlesource.com/81836
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Matchers pretty much exclusively will have to be created
through a Catalog, if one uses one.
One of the main goals of this, though, is to facilitate
the usage of automatically generated catalogs, which is
otherwise tricky.
Change-Id: I008254ce8b3e93c84b2a26d53117e2221c0f027e
Reviewed-on: https://go-review.googlesource.com/81835
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
fallback needs to be computed for both modes.
Latn data is elided from the tables, so check
for latin script at the root.
Change-Id: I6db954b9b76761380fec3b90fde962449536fa23
Reviewed-on: https://go-review.googlesource.com/81755
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Added examples.
Also improved Placeholder name extraction.
Change-Id: I3f271156a1cd364ed4ec71d3e1f8ab8c48568baf
Reviewed-on: https://go-review.googlesource.com/80236
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This more general model fits better with template-
style substitution, while still fitting well with
printf-style. It also allows hiding HTML and the like.
Modifies printf-substitution to be position-independent.
Change-Id: Ie8bd64c4fec9b8833bf8952bd02a8f3f56139e59
Reviewed-on: https://go-review.googlesource.com/79916
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
- split extraction and translation data in two types
- rewrite fmt strings into translator-readable format
- more intelligent name picking, for instance:
- use variable name for placeholders
- if var is too short, use type name, if it differs
from the underlying type.
Change-Id: I80ae9c165892491df6fcedc340d56a08269f47fe
Reviewed-on: https://go-review.googlesource.com/79237
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>