Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Internationalization for documentation #104

Open
nohorbee opened this issue Sep 16, 2014 · 11 comments
Open

Internationalization for documentation #104

nohorbee opened this issue Sep 16, 2014 · 11 comments

Comments

@nohorbee
Copy link

By adding a locales root level property, and a keyword to reference text bundles, RAML 1.0 can provide support for localization of documentation.

A resource bundle is a YAML file, which contains a mapping, where each key is the name of a text resource, and each value is the value for that text resource string in a given locale.

#%RAML 0.8
title: !bundle title
locales:
  en_US: !include docs/en_US.bundle.yaml
  es: !include docs/es.bundle.yaml
/users:
  description: !bundle users.description

Where docs/en_US.bundle.yaml contains

title: My Sample API
users.description: The users resource provides access to all users in the system

Where docs/en_US.bundle.yaml contains

title: Mi API de ejemplo
users.description: El recurso users provee acceso a todos los usuarios en el sistema

RAML processors must pick the resource bundle which best matches the consumers locale.

@nohorbee nohorbee added this to the v1.0 milestone Sep 16, 2014
@tgullotta
Copy link

Do we need to list the supported locales in the raml doc or can we just identify the root directory of the locales? The locale sub-folders should be named using the standard locale names. That way when someone creates another translation they don’t have to change he raml file itself, just add a new sub-folder.

@blakeembrey
Copy link
Contributor

@tgullotta I think we should always be explicit. Otherwise web tools won't know where or what to load ahead of time.

@usarid
Copy link
Contributor

usarid commented Sep 17, 2014

I guess the question is: do we treat locales like an enum, where the
options are limited, or do we treat them as an unspecified list and the
client must have some sidechannel to know what locales are supported, or
maybe even try one and then default back to something else?

On Wed, Sep 17, 2014 at 11:21 AM, Blake Embrey notifications@github.com
wrote:

@tgullotta https://github.com/tgullotta We should always be explicit.
Otherwise web tools won't know where or what to load.


Reply to this email directly or view it on GitHub
#104 (comment).

@blakeembrey
Copy link
Contributor

Do locales cascade when not specified? Google+ has interesting behaviour down to the region for a comparison. E.g. en-GB uses the word "bin", while en-US uses the word "trash".

@svacas
Copy link
Contributor

svacas commented Sep 30, 2014

are there any restrictions regarding where the !bundle tag can be used?
can be used on the key side?
can be used for any value?

@dmartinezg
Copy link

@svacas I would alter the wording to say that a !bundle tag should only be used in a scalar context on the value side.

@svacas
Copy link
Contributor

svacas commented Oct 20, 2014

@dmartinezg I think the usage should be restricted even more to documentation related values, otherwise it could be easily abused. You could end up with resources that have different sets of methods depending on the locale or parameters required for some languages and optional for others.

e.g:
type: !bundle flextype
required: !bundle query_param_required

@mjk-at-sag
Copy link

  1. Is there a way to explicitly access a bundled language? This would let me extract what I want from the bundle.
  2. Is there, say localeExtension as an analog to mediaTypeExtension to allow overrides in the URL? I think I can laboriously roll this by hand for just about everything except the title and the top-level documentation, but it would be desirable to have it automated and complete. E.g.
#%RAML NOT_VALID
version: v1
baseUri: http://github.com/{version}{localeExtension}
title: {locale}.title
documentation
  - title {locale}.chapter1title
    !bundle {locale}.chapter1
localeExtension:
  default: en_UK
  required: false
  pattern: ^(?:-)([a-zA-Z]{2})([-_]([a-zA-Z]{2}))?$
  magic: locale is normalized string aa_AA of matching patterns
/users{localeExtension}{mediaTypeExtension}

@johndemic
Copy link

Apologies if this is implied by the above, but it would also be desirable to localize query parameters, values, etc.

@usarid usarid modified the milestones: v1.0, v1.0 - staging Sep 30, 2015
@sichvoge sichvoge modified the milestones: v1.0 - tentatively rejected, v1.0 - staging Sep 30, 2015
@sichvoge
Copy link
Contributor

RAML 1.0 will not support an OOTB standard to define internationalization in this version. Nevertheless, it is not out of question to add support in any later version.

@sichvoge sichvoge removed this from the v1.0 - tentatively rejected milestone Apr 29, 2016
@sichvoge
Copy link
Contributor

Right now you can achieve that using overlays.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

9 participants