Discussion:
[dart-misc] intl package questions
Don Olmstead
2015-10-22 23:41:22 UTC
Permalink
I was wondering about how to properly utilize the intl package. I'm not
actually using Google Translation Kit, the files are XLIFF and I'm
converting them over to ARB. The conversion isn't a problem I'm just not
sure if I'm doing things in an optimal way.

First question is whether I need a en_US ARB. So if I had this

String continueMessage() => Intl.message(
"Hit any key to continue",
name: "continueMessage",
args: [],
desc: "Explains that we will not proceed further until "
"the user presses a key");



Do I need to have a corresponding ARB like this?

"continueMessage": "‎Hit any key to continue‏",
"@continueMessage": {
"type": "text",
"placeholders": {}
}

Or is it assumed that en_US is the default locale and I don't need to
generate an ARB?

Second question is whether there is any sort of hierarchy to ARB files. So
lets say I had translations for en_US and en_GB which have the same values
except for one string which has the word color in it so in GB it should be
colour. Do I want to have an en ARB which has everything but that one
string and then an en_US which has the US version and one string that has
the GB version?

As a corollary if I had one Arabic translation would I want to just name it
ar or do I need to take the arabic values and write ar_AR, ar_EG etc?

Thanks!
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Alan Knight' via Dart Misc
2015-10-23 00:22:32 UTC
Permalink
You do not need an ARB for the default locale, it will just directly return
the string that's in the original code without going to a translation
mechanism at all. Exactly what it means to be the default, or how it knows
which one that is, I'd have to go look at the code to refresh my memory. It
might actually be hardcoded to en_US, which seems awfully US-centric. But
basically your answer is no, you don't need one.

There is a hierarchy in the sense that if you ask for en_GB and there isn't
one, it will look for en and use that. There isn't a hierarchy in terms of
being able to fall back for individual messages as you describe. That might
be useful :-)
Post by Don Olmstead
I was wondering about how to properly utilize the intl package. I'm not
actually using Google Translation Kit, the files are XLIFF and I'm
converting them over to ARB. The conversion isn't a problem I'm just not
sure if I'm doing things in an optimal way.
First question is whether I need a en_US ARB. So if I had this
String continueMessage() => Intl.message(
"Hit any key to continue",
name: "continueMessage",
args: [],
desc: "Explains that we will not proceed further until "
"the user presses a key");
Do I need to have a corresponding ARB like this?
"continueMessage": "‎Hit any key to continue‏",
"type": "text",
"placeholders": {}
}
Or is it assumed that en_US is the default locale and I don't need to
generate an ARB?
Second question is whether there is any sort of hierarchy to ARB files. So
lets say I had translations for en_US and en_GB which have the same values
except for one string which has the word color in it so in GB it should be
colour. Do I want to have an en ARB which has everything but that one
string and then an en_US which has the US version and one string that has
the GB version?
As a corollary if I had one Arabic translation would I want to just name
it ar or do I need to take the arabic values and write ar_AR, ar_EG etc?
Thanks!
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Don Olmstead
2015-10-23 00:29:36 UTC
Permalink
Thanks for clearing that up Alan. So probably as a general rule if I had
translations for "ar_AR" but no other "ar_*" then I should write that as
"ar". Are there any performance concerns there in terms of searching or
does the codegen sort that part out?

If you want an issue with the hierarchy I can open one up for you. Just let
me know.

On Thu, Oct 22, 2015 at 5:22 PM, 'Alan Knight' via Dart Misc <
Post by 'Alan Knight' via Dart Misc
You do not need an ARB for the default locale, it will just directly
return the string that's in the original code without going to a
translation mechanism at all. Exactly what it means to be the default, or
how it knows which one that is, I'd have to go look at the code to refresh
my memory. It might actually be hardcoded to en_US, which seems awfully
US-centric. But basically your answer is no, you don't need one.
There is a hierarchy in the sense that if you ask for en_GB and there
isn't one, it will look for en and use that. There isn't a hierarchy in
terms of being able to fall back for individual messages as you describe.
That might be useful :-)
Post by Don Olmstead
I was wondering about how to properly utilize the intl package. I'm not
actually using Google Translation Kit, the files are XLIFF and I'm
converting them over to ARB. The conversion isn't a problem I'm just not
sure if I'm doing things in an optimal way.
First question is whether I need a en_US ARB. So if I had this
String continueMessage() => Intl.message(
"Hit any key to continue",
name: "continueMessage",
args: [],
desc: "Explains that we will not proceed further until "
"the user presses a key");
Do I need to have a corresponding ARB like this?
"continueMessage": "‎Hit any key to continue‏",
"type": "text",
"placeholders": {}
}
Or is it assumed that en_US is the default locale and I don't need to
generate an ARB?
Second question is whether there is any sort of hierarchy to ARB files.
So lets say I had translations for en_US and en_GB which have the same
values except for one string which has the word color in it so in GB it
should be colour. Do I want to have an en ARB which has everything but that
one string and then an en_US which has the US version and one string that
has the GB version?
As a corollary if I had one Arabic translation would I want to just name
it ar or do I need to take the arabic values and write ar_AR, ar_EG etc?
Thanks!
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Alan Knight' via Dart Misc
2015-10-23 22:00:31 UTC
Permalink
It is probably a bit slower when it has to fall back to another locale,
although I doubt it's significant in the context of getting a message
that's going to be displayed to the user. Basically a map lookup using the
first key, then some minor string operations to get the fallback version
and another map lookup.

Please file an issue. I don't know how quickly (or even if) we'll get to
it, but it does seem interesting. I suspect that the way people are
handling it is at the data file level. That is, they generate "ar_AR" with
all the possible messages, but most of them are just duplicated from "ar".
Which I guess would also avoid the issue that when you're deferred loading
the library, you'd have to do additional loads for any fallbacks. So you
get more code size on disk, but it might be faster to load.
Post by Don Olmstead
Thanks for clearing that up Alan. So probably as a general rule if I had
translations for "ar_AR" but no other "ar_*" then I should write that as
"ar". Are there any performance concerns there in terms of searching or
does the codegen sort that part out?
If you want an issue with the hierarchy I can open one up for you. Just
let me know.
On Thu, Oct 22, 2015 at 5:22 PM, 'Alan Knight' via Dart Misc <
Post by 'Alan Knight' via Dart Misc
You do not need an ARB for the default locale, it will just directly
return the string that's in the original code without going to a
translation mechanism at all. Exactly what it means to be the default, or
how it knows which one that is, I'd have to go look at the code to refresh
my memory. It might actually be hardcoded to en_US, which seems awfully
US-centric. But basically your answer is no, you don't need one.
There is a hierarchy in the sense that if you ask for en_GB and there
isn't one, it will look for en and use that. There isn't a hierarchy in
terms of being able to fall back for individual messages as you describe.
That might be useful :-)
Post by Don Olmstead
I was wondering about how to properly utilize the intl package. I'm not
actually using Google Translation Kit, the files are XLIFF and I'm
converting them over to ARB. The conversion isn't a problem I'm just not
sure if I'm doing things in an optimal way.
First question is whether I need a en_US ARB. So if I had this
String continueMessage() => Intl.message(
"Hit any key to continue",
name: "continueMessage",
args: [],
desc: "Explains that we will not proceed further until "
"the user presses a key");
Do I need to have a corresponding ARB like this?
"continueMessage": "‎Hit any key to continue‏",
"type": "text",
"placeholders": {}
}
Or is it assumed that en_US is the default locale and I don't need to
generate an ARB?
Second question is whether there is any sort of hierarchy to ARB files.
So lets say I had translations for en_US and en_GB which have the same
values except for one string which has the word color in it so in GB it
should be colour. Do I want to have an en ARB which has everything but that
one string and then an en_US which has the US version and one string that
has the GB version?
As a corollary if I had one Arabic translation would I want to just name
it ar or do I need to take the arabic values and write ar_AR, ar_EG etc?
Thanks!
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to
http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Don Olmstead
2015-10-24 00:50:00 UTC
Permalink
Will do. Also I noticed the Polymer intl example seems to have gone away.
Would probably be nice to have some more examples with the intl library
especially something with an ARB file hanging around. Open an issue around
that as well?

On Fri, Oct 23, 2015 at 3:00 PM, 'Alan Knight' via Dart Misc <
Post by 'Alan Knight' via Dart Misc
It is probably a bit slower when it has to fall back to another locale,
although I doubt it's significant in the context of getting a message
that's going to be displayed to the user. Basically a map lookup using the
first key, then some minor string operations to get the fallback version
and another map lookup.
Please file an issue. I don't know how quickly (or even if) we'll get to
it, but it does seem interesting. I suspect that the way people are
handling it is at the data file level. That is, they generate "ar_AR" with
all the possible messages, but most of them are just duplicated from "ar".
Which I guess would also avoid the issue that when you're deferred loading
the library, you'd have to do additional loads for any fallbacks. So you
get more code size on disk, but it might be faster to load.
Post by Don Olmstead
Thanks for clearing that up Alan. So probably as a general rule if I had
translations for "ar_AR" but no other "ar_*" then I should write that as
"ar". Are there any performance concerns there in terms of searching or
does the codegen sort that part out?
If you want an issue with the hierarchy I can open one up for you. Just
let me know.
On Thu, Oct 22, 2015 at 5:22 PM, 'Alan Knight' via Dart Misc <
Post by 'Alan Knight' via Dart Misc
You do not need an ARB for the default locale, it will just directly
return the string that's in the original code without going to a
translation mechanism at all. Exactly what it means to be the default, or
how it knows which one that is, I'd have to go look at the code to refresh
my memory. It might actually be hardcoded to en_US, which seems awfully
US-centric. But basically your answer is no, you don't need one.
There is a hierarchy in the sense that if you ask for en_GB and there
isn't one, it will look for en and use that. There isn't a hierarchy in
terms of being able to fall back for individual messages as you describe.
That might be useful :-)
Post by Don Olmstead
I was wondering about how to properly utilize the intl package. I'm not
actually using Google Translation Kit, the files are XLIFF and I'm
converting them over to ARB. The conversion isn't a problem I'm just not
sure if I'm doing things in an optimal way.
First question is whether I need a en_US ARB. So if I had this
String continueMessage() => Intl.message(
"Hit any key to continue",
name: "continueMessage",
args: [],
desc: "Explains that we will not proceed further until "
"the user presses a key");
Do I need to have a corresponding ARB like this?
"continueMessage": "‎Hit any key to continue‏",
"type": "text",
"placeholders": {}
}
Or is it assumed that en_US is the default locale and I don't need to
generate an ARB?
Second question is whether there is any sort of hierarchy to ARB files.
So lets say I had translations for en_US and en_GB which have the same
values except for one string which has the word color in it so in GB it
should be colour. Do I want to have an en ARB which has everything but that
one string and then an en_US which has the US version and one string that
has the GB version?
As a corollary if I had one Arabic translation would I want to just
name it ar or do I need to take the arabic values and write ar_AR, ar_EG
etc?
Thanks!
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to
http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to
http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Alan Knight' via Dart Misc
2015-10-26 22:51:14 UTC
Permalink
That's odd. Please do.
Post by Don Olmstead
Will do. Also I noticed the Polymer intl example seems to have gone away.
Would probably be nice to have some more examples with the intl library
especially something with an ARB file hanging around. Open an issue around
that as well?
On Fri, Oct 23, 2015 at 3:00 PM, 'Alan Knight' via Dart Misc <
Post by 'Alan Knight' via Dart Misc
It is probably a bit slower when it has to fall back to another locale,
although I doubt it's significant in the context of getting a message
that's going to be displayed to the user. Basically a map lookup using the
first key, then some minor string operations to get the fallback version
and another map lookup.
Please file an issue. I don't know how quickly (or even if) we'll get to
it, but it does seem interesting. I suspect that the way people are
handling it is at the data file level. That is, they generate "ar_AR" with
all the possible messages, but most of them are just duplicated from "ar".
Which I guess would also avoid the issue that when you're deferred loading
the library, you'd have to do additional loads for any fallbacks. So you
get more code size on disk, but it might be faster to load.
Post by Don Olmstead
Thanks for clearing that up Alan. So probably as a general rule if I had
translations for "ar_AR" but no other "ar_*" then I should write that as
"ar". Are there any performance concerns there in terms of searching or
does the codegen sort that part out?
If you want an issue with the hierarchy I can open one up for you. Just
let me know.
On Thu, Oct 22, 2015 at 5:22 PM, 'Alan Knight' via Dart Misc <
Post by 'Alan Knight' via Dart Misc
You do not need an ARB for the default locale, it will just directly
return the string that's in the original code without going to a
translation mechanism at all. Exactly what it means to be the default, or
how it knows which one that is, I'd have to go look at the code to refresh
my memory. It might actually be hardcoded to en_US, which seems awfully
US-centric. But basically your answer is no, you don't need one.
There is a hierarchy in the sense that if you ask for en_GB and there
isn't one, it will look for en and use that. There isn't a hierarchy in
terms of being able to fall back for individual messages as you describe.
That might be useful :-)
Post by Don Olmstead
I was wondering about how to properly utilize the intl package. I'm
not actually using Google Translation Kit, the files are XLIFF and I'm
converting them over to ARB. The conversion isn't a problem I'm just not
sure if I'm doing things in an optimal way.
First question is whether I need a en_US ARB. So if I had this
String continueMessage() => Intl.message(
"Hit any key to continue",
name: "continueMessage",
args: [],
desc: "Explains that we will not proceed further until "
"the user presses a key");
Do I need to have a corresponding ARB like this?
"continueMessage": "‎Hit any key to continue‏",
"type": "text",
"placeholders": {}
}
Or is it assumed that en_US is the default locale and I don't need to
generate an ARB?
Second question is whether there is any sort of hierarchy to ARB
files. So lets say I had translations for en_US and en_GB which have the
same values except for one string which has the word color in it so in GB
it should be colour. Do I want to have an en ARB which has everything but
that one string and then an en_US which has the US version and one string
that has the GB version?
As a corollary if I had one Arabic translation would I want to just
name it ar or do I need to take the arabic values and write ar_AR, ar_EG
etc?
Thanks!
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to
http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to
http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to
http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Don Olmstead
2015-10-26 23:07:45 UTC
Permalink
https://github.com/dart-lang/intl/issues/85 for hierarchy
https://github.com/dart-lang/intl/issues/84 for example arb project

On Mon, Oct 26, 2015 at 3:51 PM, 'Alan Knight' via Dart Misc <
Post by 'Alan Knight' via Dart Misc
That's odd. Please do.
Post by Don Olmstead
Will do. Also I noticed the Polymer intl example seems to have gone away.
Would probably be nice to have some more examples with the intl library
especially something with an ARB file hanging around. Open an issue around
that as well?
On Fri, Oct 23, 2015 at 3:00 PM, 'Alan Knight' via Dart Misc <
Post by 'Alan Knight' via Dart Misc
It is probably a bit slower when it has to fall back to another locale,
although I doubt it's significant in the context of getting a message
that's going to be displayed to the user. Basically a map lookup using the
first key, then some minor string operations to get the fallback version
and another map lookup.
Please file an issue. I don't know how quickly (or even if) we'll get to
it, but it does seem interesting. I suspect that the way people are
handling it is at the data file level. That is, they generate "ar_AR" with
all the possible messages, but most of them are just duplicated from "ar".
Which I guess would also avoid the issue that when you're deferred loading
the library, you'd have to do additional loads for any fallbacks. So you
get more code size on disk, but it might be faster to load.
Post by Don Olmstead
Thanks for clearing that up Alan. So probably as a general rule if I
had translations for "ar_AR" but no other "ar_*" then I should write that
as "ar". Are there any performance concerns there in terms of searching or
does the codegen sort that part out?
If you want an issue with the hierarchy I can open one up for you. Just
let me know.
On Thu, Oct 22, 2015 at 5:22 PM, 'Alan Knight' via Dart Misc <
Post by 'Alan Knight' via Dart Misc
You do not need an ARB for the default locale, it will just directly
return the string that's in the original code without going to a
translation mechanism at all. Exactly what it means to be the default, or
how it knows which one that is, I'd have to go look at the code to refresh
my memory. It might actually be hardcoded to en_US, which seems awfully
US-centric. But basically your answer is no, you don't need one.
There is a hierarchy in the sense that if you ask for en_GB and there
isn't one, it will look for en and use that. There isn't a hierarchy in
terms of being able to fall back for individual messages as you describe.
That might be useful :-)
Post by Don Olmstead
I was wondering about how to properly utilize the intl package. I'm
not actually using Google Translation Kit, the files are XLIFF and I'm
converting them over to ARB. The conversion isn't a problem I'm just not
sure if I'm doing things in an optimal way.
First question is whether I need a en_US ARB. So if I had this
String continueMessage() => Intl.message(
"Hit any key to continue",
name: "continueMessage",
args: [],
desc: "Explains that we will not proceed further until "
"the user presses a key");
Do I need to have a corresponding ARB like this?
"continueMessage": "‎Hit any key to continue‏",
"type": "text",
"placeholders": {}
}
Or is it assumed that en_US is the default locale and I don't need to
generate an ARB?
Second question is whether there is any sort of hierarchy to ARB
files. So lets say I had translations for en_US and en_GB which have the
same values except for one string which has the word color in it so in GB
it should be colour. Do I want to have an en ARB which has everything but
that one string and then an en_US which has the US version and one string
that has the GB version?
As a corollary if I had one Arabic translation would I want to just
name it ar or do I need to take the arabic values and write ar_AR, ar_EG
etc?
Thanks!
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to
http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it,
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to
http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to
http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to
http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Don Olmstead
2016-01-06 23:00:18 UTC
Permalink
Reviving because I had a couple more questions for @Alan.

1) Do the files have to be named anything in particular? I found that if I
did en_GB.arb then the locale generated was GB which is wrong. Things
seemed to work out if I renamed the file as messages_en_GB.arb before
generating from ARB. Not sure if its a bug. Also I noticed the filename
generated was messages_en_GB.dart which breaks style guidelines. Not sure
if I should be doing a different naming though to resolve that.

2) If I had two Spanish translations, es-ES and es-419, and multiple
locales is there any way for intl to generate mappings so there is only
messages_es_ES.dart and messages_es_419.dart?

Would guess something like that would look like this within the generated
messages_all.dart

import 'messages_es_ES.dart' deferred as messages_es_ES;
import 'messages_es_419.dart' deferred as messages_es_419;




Map<String, Function> _deferredLibraries = {
'es_AR' : () => messages_es_ES.loadLibrary(),
'es_BO' : () => messages_es_419.loadLibrary(),
'es_BR' : () => messages_es_ES.loadLibrary(),
'es_CL' : () => messages_es_ES.loadLibrary(),
'es_CO' : () => messages_es_419.loadLibrary()
};


MessageLookupByLibrary _findExact(localeName) {
switch (localeName) {
case 'en_GB' : return messages_en_GB.messages;
case 'es_AR' : return messages_es_ES.messages;
case 'es_BO' : return messages_es_419.messages;
case 'es_BR' : return messages_es_ES.messages;
case 'es_CL' : return messages_es_ES.messages;
case 'es_CO' : return messages_es_419.messages;
default: return null;
}
}
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Alan Knight' via Dart Misc
2016-01-07 01:08:13 UTC
Permalink
The name of the files shouldn't matter at all. It finds them if they have a
.arb extension, but the locale, and thus the name of the generated file,
comes from the data in the file. Just to check, I tried renaming one of the
ARB files that debug.sh generates to something nonsensical, and it didn't
affect anything at all. So I'm not sure what you were seeing.

Right now there isn't any mechanism for re-using translations that are the
same between locales. About the best you could do was make one of them be
"es" and have locales that weren't listed fall back to it. Then you
explicitly list the locales that have the other. So in your case that would
look something like

switch (localeName) {
case 'en_GB' : return messages_en_GB.messages;
case 'es_BO' : return messages_es_419.messages;
case 'es' : return messages_es.messages;
case 'es_CO' : return messages_es_419.messages;
...

But it would be a useful thing to be able to do. Possibly the simplest
mechanism would be if the ARB file could list multiple locales, and then
the generation could pick one to generate and have all of them refer to it.
Post by Don Olmstead
1) Do the files have to be named anything in particular? I found that if I
did en_GB.arb then the locale generated was GB which is wrong. Things
seemed to work out if I renamed the file as messages_en_GB.arb before
generating from ARB. Not sure if its a bug. Also I noticed the filename
generated was messages_en_GB.dart which breaks style guidelines. Not sure
if I should be doing a different naming though to resolve that.
2) If I had two Spanish translations, es-ES and es-419, and multiple
locales is there any way for intl to generate mappings so there is only
messages_es_ES.dart and messages_es_419.dart?
Would guess something like that would look like this within the generated
messages_all.dart
import 'messages_es_ES.dart' deferred as messages_es_ES;
import 'messages_es_419.dart' deferred as messages_es_419;
Map<String, Function> _deferredLibraries = {
'es_AR' : () => messages_es_ES.loadLibrary(),
'es_BO' : () => messages_es_419.loadLibrary(),
'es_BR' : () => messages_es_ES.loadLibrary(),
'es_CL' : () => messages_es_ES.loadLibrary(),
'es_CO' : () => messages_es_419.loadLibrary()
};
MessageLookupByLibrary _findExact(localeName) {
switch (localeName) {
case 'en_GB' : return messages_en_GB.messages;
case 'es_AR' : return messages_es_ES.messages;
case 'es_BO' : return messages_es_419.messages;
case 'es_BR' : return messages_es_ES.messages;
case 'es_CL' : return messages_es_ES.messages;
case 'es_CO' : return messages_es_419.messages;
default: return null;
}
}
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Don Olmstead
2016-01-07 01:24:55 UTC
Permalink
I didn't have "_locale" in the ARB JSONs. Will need to fix my exporter for
it. The locale issue something worth opening a bug? Generating to the arb
format was a bit wonky as there aren't a whole lot of examples out there.
Seems to primarily be a Google thing.

On Wed, Jan 6, 2016 at 5:08 PM, 'Alan Knight' via Dart Misc <
Post by 'Alan Knight' via Dart Misc
The name of the files shouldn't matter at all. It finds them if they have
a .arb extension, but the locale, and thus the name of the generated file,
comes from the data in the file. Just to check, I tried renaming one of the
ARB files that debug.sh generates to something nonsensical, and it didn't
affect anything at all. So I'm not sure what you were seeing.
Right now there isn't any mechanism for re-using translations that are the
same between locales. About the best you could do was make one of them be
"es" and have locales that weren't listed fall back to it. Then you
explicitly list the locales that have the other. So in your case that would
look something like
switch (localeName) {
case 'en_GB' : return messages_en_GB.messages;
case 'es_BO' : return messages_es_419.messages;
case 'es' : return messages_es.messages;
case 'es_CO' : return messages_es_419.messages;
...
But it would be a useful thing to be able to do. Possibly the simplest
mechanism would be if the ARB file could list multiple locales, and then
the generation could pick one to generate and have all of them refer to it.
Post by Don Olmstead
1) Do the files have to be named anything in particular? I found that if
I did en_GB.arb then the locale generated was GB which is wrong. Things
seemed to work out if I renamed the file as messages_en_GB.arb before
generating from ARB. Not sure if its a bug. Also I noticed the filename
generated was messages_en_GB.dart which breaks style guidelines. Not sure
if I should be doing a different naming though to resolve that.
2) If I had two Spanish translations, es-ES and es-419, and multiple
locales is there any way for intl to generate mappings so there is only
messages_es_ES.dart and messages_es_419.dart?
Would guess something like that would look like this within the generated
messages_all.dart
import 'messages_es_ES.dart' deferred as messages_es_ES;
import 'messages_es_419.dart' deferred as messages_es_419;
Map<String, Function> _deferredLibraries = {
'es_AR' : () => messages_es_ES.loadLibrary(),
'es_BO' : () => messages_es_419.loadLibrary(),
'es_BR' : () => messages_es_ES.loadLibrary(),
'es_CL' : () => messages_es_ES.loadLibrary(),
'es_CO' : () => messages_es_419.loadLibrary()
};
MessageLookupByLibrary _findExact(localeName) {
switch (localeName) {
case 'en_GB' : return messages_en_GB.messages;
case 'es_AR' : return messages_es_ES.messages;
case 'es_BO' : return messages_es_419.messages;
case 'es_BR' : return messages_es_ES.messages;
case 'es_CL' : return messages_es_ES.messages;
case 'es_CO' : return messages_es_419.messages;
default: return null;
}
}
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Alan Knight' via Dart Misc
2016-01-07 01:58:32 UTC
Permalink
Yes, worth opening a bug.

The ARB format is not especially common, but it's the only one I found that
supports the full ICU-style semantics that the Dart messages use, as far as
plurals/genders, etc. And Google Translate does support it, so that's
something. But I haven't looked at its output in a good while, and it's
probably worth reviewing and seeing if the format has changed.
Post by Don Olmstead
I didn't have "_locale" in the ARB JSONs. Will need to fix my exporter for
it. The locale issue something worth opening a bug? Generating to the arb
format was a bit wonky as there aren't a whole lot of examples out there.
Seems to primarily be a Google thing.
On Wed, Jan 6, 2016 at 5:08 PM, 'Alan Knight' via Dart Misc <
Post by 'Alan Knight' via Dart Misc
The name of the files shouldn't matter at all. It finds them if they have
a .arb extension, but the locale, and thus the name of the generated file,
comes from the data in the file. Just to check, I tried renaming one of the
ARB files that debug.sh generates to something nonsensical, and it didn't
affect anything at all. So I'm not sure what you were seeing.
Right now there isn't any mechanism for re-using translations that are
the same between locales. About the best you could do was make one of them
be "es" and have locales that weren't listed fall back to it. Then you
explicitly list the locales that have the other. So in your case that would
look something like
switch (localeName) {
case 'en_GB' : return messages_en_GB.messages;
case 'es_BO' : return messages_es_419.messages;
case 'es' : return messages_es.messages;
case 'es_CO' : return messages_es_419.messages;
...
But it would be a useful thing to be able to do. Possibly the simplest
mechanism would be if the ARB file could list multiple locales, and then
the generation could pick one to generate and have all of them refer to it.
Post by Don Olmstead
1) Do the files have to be named anything in particular? I found that if
I did en_GB.arb then the locale generated was GB which is wrong. Things
seemed to work out if I renamed the file as messages_en_GB.arb before
generating from ARB. Not sure if its a bug. Also I noticed the filename
generated was messages_en_GB.dart which breaks style guidelines. Not sure
if I should be doing a different naming though to resolve that.
2) If I had two Spanish translations, es-ES and es-419, and multiple
locales is there any way for intl to generate mappings so there is only
messages_es_ES.dart and messages_es_419.dart?
Would guess something like that would look like this within the
generated messages_all.dart
import 'messages_es_ES.dart' deferred as messages_es_ES;
import 'messages_es_419.dart' deferred as messages_es_419;
Map<String, Function> _deferredLibraries = {
'es_AR' : () => messages_es_ES.loadLibrary(),
'es_BO' : () => messages_es_419.loadLibrary(),
'es_BR' : () => messages_es_ES.loadLibrary(),
'es_CL' : () => messages_es_ES.loadLibrary(),
'es_CO' : () => messages_es_419.loadLibrary()
};
MessageLookupByLibrary _findExact(localeName) {
switch (localeName) {
case 'en_GB' : return messages_en_GB.messages;
case 'es_AR' : return messages_es_ES.messages;
case 'es_BO' : return messages_es_419.messages;
case 'es_BR' : return messages_es_ES.messages;
case 'es_CL' : return messages_es_ES.messages;
case 'es_CO' : return messages_es_419.messages;
default: return null;
}
}
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to
http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google
Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Don Olmstead
2016-01-07 03:30:31 UTC
Permalink
https://github.com/dart-lang/intl/issues/98 There you go.

Got a link to the ARB format? I haven't been able to find it since things
moved to Github.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
'Alan Knight' via Dart Misc
2016-01-07 18:05:32 UTC
Permalink
Yeah, it was hidden in the Wiki.

https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification
Post by Don Olmstead
https://github.com/dart-lang/intl/issues/98 There you go.
Got a link to the ARB format? I haven't been able to find it since things
moved to Github.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Don Olmstead
2016-01-07 18:41:07 UTC
Permalink
Doh always forget about Github Wikis. Thanks Alan!

On Thu, Jan 7, 2016 at 10:05 AM, 'Alan Knight' via Dart Misc <
Post by 'Alan Knight' via Dart Misc
Yeah, it was hidden in the Wiki.
https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification
Post by Don Olmstead
https://github.com/dart-lang/intl/issues/98 There you go.
Got a link to the ARB format? I haven't been able to find it since things
moved to Github.
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/
For HOWTO questions, visit http://stackoverflow.com/tags/dart
To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Loading...